Skip to content

Commit

Permalink
Merge pull request #18026 from rwjblue/enable-feature-flags
Browse files Browse the repository at this point in the history
Enabling featured discussed in 2019-05-03 core team meeting.
  • Loading branch information
rwjblue authored May 13, 2019
2 parents 24e4292 + 7a64ac6 commit e7bd12a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
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

0 comments on commit e7bd12a

Please sign in to comment.