Skip to content

Commit

Permalink
[BUGFIX beta] Deprecate Ember.Select global
Browse files Browse the repository at this point in the history
refs #11377
  • Loading branch information
bantic committed Jun 11, 2015
1 parent e3f6866 commit 9ddffd2
Show file tree
Hide file tree
Showing 3 changed files with 18 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
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
*/
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

0 comments on commit 9ddffd2

Please sign in to comment.