Skip to content

Commit

Permalink
Updating PR emberjs#15078 with rwjblue review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Hassan Abdel-Rahman committed Mar 28, 2017
1 parent f36fcbe commit 523d8da
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
18 changes: 8 additions & 10 deletions packages/ember-glimmer/tests/integration/event-dispatcher-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ moduleFor('EventDispatcher', class extends RenderingTest {
template: `<input id="is-done" type="checkbox">`
});


expectDeprecation(/`eventManager` has been deprecated/);
this.render(`{{x-foo}}`);

this.runTask(() => this.$('#is-done').trigger('click'));
Expand Down Expand Up @@ -90,6 +92,7 @@ moduleFor('EventDispatcher', class extends RenderingTest {
template: `<input id="is-done" type="checkbox">`
});

expectDeprecation(/`eventManager` has been deprecated/);
this.render(`{{x-foo}}`);

this.runTask(() => this.$('#is-done').trigger('click'));
Expand Down Expand Up @@ -139,8 +142,7 @@ moduleFor('EventDispatcher#setup', class extends RenderingTest {
this.$('div').trigger('myevent');
}

['@test canDispatchToEventManager is deprecated'](assert) {
this.dispatcher.canDispatchToEventManager = null;
['@test eventManager is deprecated'](assert) {
this.registerComponent('x-foo', {
ComponentClass: Component.extend({
eventManager: {
Expand All @@ -150,21 +152,17 @@ moduleFor('EventDispatcher#setup', class extends RenderingTest {
template: `<p>Hello!</p>`
});

expectDeprecation(() => {
this.render(`{{x-foo}}`);
}, '[DEPRECATED] `canDispatchToEventManager` has been deprecated.');

this.$('div').trigger('myevent');
expectDeprecation(/`eventManager` has been deprecated/);
this.render(`{{x-foo}}`);
}

['@test canDispatchToEventManager is deprecated in EventDispatcher'](assert) {
let MyDispatcher = EventDispatcher.extend({
canDispatchToEventManager: null
});

expectDeprecation(() => {
MyDispatcher.create();
}, '[DEPRECATED] `canDispatchToEventManager` has been deprecated.');
expectDeprecation(/`canDispatchToEventManager` has been deprecated/);
MyDispatcher.create();
}

['@test a rootElement can be specified'](assert) {
Expand Down
6 changes: 3 additions & 3 deletions packages/ember-views/lib/mixins/view_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,11 @@ export default Mixin.create({
let dispatcher = owner && owner.lookup('event_dispatcher:main');

deprecate(
`[DEPRECATED] \`canDispatchToEventManager\` has been deprecated.`,
!('canDispatchToEventManager' in dispatcher),
`\`eventManager\` has been deprecated in ${this}.`,
false,
{
id: 'ember-views.event-dispatcher.canDispatchToEventManager',
until: '3.0.0'
until: '2.16.0'
}
);

Expand Down
4 changes: 2 additions & 2 deletions packages/ember-views/lib/system/event_dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ export default EmberObject.extend({
assert('EventDispatcher should never be instantiated in fastboot mode. Please report this as an Ember bug.', environment.hasDOM);

deprecate(
`[DEPRECATED] \`canDispatchToEventManager\` has been deprecated.`,
`\`canDispatchToEventManager\` has been deprecated in ${this}.`,
!('canDispatchToEventManager' in this),
{
id: 'ember-views.event-dispatcher.canDispatchToEventManager',
until: '3.0.0'
until: '2.16.0'
}
);
},
Expand Down

0 comments on commit 523d8da

Please sign in to comment.