Skip to content

Commit

Permalink
Prevent container deprecation for tagless view assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Nov 13, 2015
1 parent 04ddd6a commit 1186a2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/ember-views/lib/components/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ var Component = View.extend(TargetActionSupport, {
assert(
`You can not define a function that handles DOM events in the \`${this}\` tagless component since it doesn't have any DOM element.`,
this.tagName !== '' || !(() => {
let eventDispatcher = this.container.lookup('event_dispatcher:main');
let eventDispatcher = getOwner(this).lookup('event_dispatcher:main');
let events = (eventDispatcher && eventDispatcher._finalEvents) || {};

for (let key in events) {
Expand Down
7 changes: 4 additions & 3 deletions packages/ember-views/tests/views/component_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Component from 'ember-views/components/component';

import { MUTABLE_CELL } from 'ember-views/compat/attrs-proxy';
import buildOwner from 'container/tests/test-helpers/build-owner';
import { OWNER } from 'container/owner';

var a_slice = Array.prototype.slice;

Expand Down Expand Up @@ -310,7 +311,7 @@ QUnit.test('throws an error if an event function is defined in a tagless compone

let TestComponent = Component.extend({
tagName: '',
container: appInstance,
[OWNER]: appInstance,
click() { }
});

Expand Down Expand Up @@ -339,7 +340,7 @@ QUnit.test('throws an error if an Application custom event handler is defined in

let TestComponent = Component.extend({
tagName: '',
container: appInstance,
[OWNER]: appInstance,
sauce() { }
});

Expand Down Expand Up @@ -367,7 +368,7 @@ QUnit.test('throws an error if an ApplicationInstance custom event handler is de

let TestComponent = Component.extend({
tagName: '',
container: appInstance,
[OWNER]: appInstance,
hurts() { }
});

Expand Down

0 comments on commit 1186a2b

Please sign in to comment.