Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent container deprecation for tagless view assertion. #12599

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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