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

Enabling featured discussed in 2019-05-03 core team meeting. #18026

Merged
merged 3 commits into from
May 13, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { EMBER_GLIMMER_ON_MODIFIER } from '@ember/canary-features';
import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers';
import { isChrome, isFirefox } from '@ember/-internals/browser-environment';
import { privatize as P } from '@ember/-internals/container';
import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';

const isIE11 = !window.ActiveXObject && 'ActiveXObject' in window;

Expand Down Expand Up @@ -320,12 +321,23 @@ if (EMBER_GLIMMER_ON_MODIFIER) {
}, /You must pass a function as the second argument to the `on` modifier/);
}

'@test asserts if the provided callback accesses `this` without being bound prior to passing to on'() {
'@test asserts if the provided callback accesses `this` without being bound prior to passing to on'(
assert
) {
this.render(`<button {{on 'click' this.myFunc}}>Click Me</button>`, {
myFunc() {
expectAssertion(() => {
this.arg1;
}, /You accessed `this.arg1` from a function passed to the `on` modifier, but the function itself was not bound to a valid `this` context. Consider updating to usage of `@action`./);
if (HAS_NATIVE_PROXY) {
expectAssertion(() => {
this.arg1;
}, /You accessed `this.arg1` from a function passed to the `on` modifier, but the function itself was not bound to a valid `this` context. Consider updating to usage of `@action`./);
} else {
// IE11
assert.strictEqual(
this,
null,
'this is null on browsers without native proxy support'
);
}
},

arg1: 'foo',
Expand Down
4 changes: 2 additions & 2 deletions packages/@ember/canary-features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const DEFAULT_FEATURES = {
EMBER_NATIVE_DECORATOR_SUPPORT: true,
EMBER_GLIMMER_FN_HELPER: true,
EMBER_CUSTOM_COMPONENT_ARG_PROXY: null,
EMBER_GLIMMER_ON_MODIFIER: null,
EMBER_FRAMEWORK_OBJECT_OWNER_ARGUMENT: null,
EMBER_GLIMMER_ON_MODIFIER: true,
EMBER_FRAMEWORK_OBJECT_OWNER_ARGUMENT: true,
};

/**
Expand Down