Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] Deprecate Ember.Select global #11416

Merged
merged 1 commit into from
Jun 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/ember-views/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import TextField from "ember-views/views/text_field";
import TextArea from "ember-views/views/text_area";

import {
Select,
DeprecatedSelect,
SelectOption,
SelectOptgroup
} from "ember-views/views/select";
Expand All @@ -48,7 +48,7 @@ import LegacyEachView from "ember-views/views/legacy_each_view";

@method $
@for Ember
@public
@public
*/

// BEGIN EXPORTS
Expand All @@ -71,7 +71,7 @@ Ember.Checkbox = Checkbox;
Ember.TextField = TextField;
Ember.TextArea = TextArea;

Ember.Select = Select;
Ember.Select = DeprecatedSelect;
Ember.SelectOption = SelectOption;
Ember.SelectOptgroup = SelectOptgroup;

Expand Down
9 changes: 9 additions & 0 deletions packages/ember-views/lib/views/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ var SelectOptgroup = View.extend({
@namespace Ember
@extends Ember.View
@public
@deprecated See http://emberjs.com/deprecations/v1.x/#toc_ember-select
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mixonic Added @deprecated to the docs for Ember.Select

*/
var Select = View.extend({
instrumentDisplay: 'Ember.Select',
Expand Down Expand Up @@ -674,9 +675,17 @@ var Select = View.extend({
}
});

var DeprecatedSelect = Select.extend({
init() {
this._super(...arguments);
Ember.deprecate(`Ember.Select is deprecated. Consult the Deprecations Guide for a migration strategy.`, !!Ember.ENV._ENABLE_LEGACY_VIEW_SUPPORT, { url: 'http://emberjs.com/deprecations/v1.x/#toc_ember-select' });
}
});

export default Select;
export {
Select,
DeprecatedSelect,
SelectOption,
SelectOptgroup
};
6 changes: 6 additions & 0 deletions packages/ember-views/tests/views/select_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ function selectedOptions() {
return select.get('childViews').mapBy('selected');
}

QUnit.test('using the Ember.Select global is deprecated', function(assert) {
expectDeprecation(function() {
Ember.Select.create();
}, /Ember.Select is deprecated./);
});

QUnit.test("has 'ember-view' and 'ember-select' CSS classes", function() {
deepEqual(select.get('classNames'), ['ember-view', 'ember-select']);
});
Expand Down