Skip to content

Commit

Permalink
add deprecation to NAME_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
bekzod committed Jun 28, 2018
1 parent 5ade8f6 commit c4667e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 14 additions & 1 deletion packages/ember/index.js
Expand Up @@ -202,7 +202,20 @@ Ember.canInvoke = utils.canInvoke;
Ember.tryInvoke = utils.tryInvoke;
Ember.wrap = utils.wrap;
Ember.uuid = utils.uuid;
Ember.NAME_KEY = utils.NAME_KEY;
Ember.setName = utils.setName;

Object.defineProperty(Ember, 'NAME_KEY', {
enumerable: false,
get() {
deprecate('Using `Ember.NAME_KEY` is deprecated, override `.toString` instead', false, {
id: 'ember-name-key-usage',
until: '3.5.0',
});

return utils.NAME_KEY;
},
});

Ember._Cache = utils.Cache;

// ****container****
Expand Down
7 changes: 6 additions & 1 deletion packages/ember/tests/reexports_test.js
Expand Up @@ -34,6 +34,12 @@ moduleFor(
}, /EXTEND_PROTOTYPES is deprecated/);
}

['@test Ember.NAME_KEY is deprecated']() {
expectDeprecation(() => {
Ember.NAME_KEY;
}, 'Using `Ember.NAME_KEY` is deprecated, override `.toString` instead');
}

'@test Ember.FEATURES is exported'(assert) {
for (let feature in FEATURES) {
assert.equal(
Expand Down Expand Up @@ -64,7 +70,6 @@ let allExports = [
['canInvoke', 'ember-utils'],
['tryInvoke', 'ember-utils'],
['wrap', 'ember-utils'],
['NAME_KEY', 'ember-utils'],

// container
['Registry', 'container', 'Registry'],
Expand Down

0 comments on commit c4667e0

Please sign in to comment.