Skip to content

Commit

Permalink
[BUGFIX beta] Deprecate Ember.Select global
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic committed Jun 10, 2015
1 parent 3189a1e commit ab8531b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
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
8 changes: 8 additions & 0 deletions packages/ember-views/lib/views/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,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-view' });
}
});

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

0 comments on commit ab8531b

Please sign in to comment.