diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6fd88fabd8..70ffd5ef728 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,10 @@ on: permissions: contents: read +env: + OVERRIDE_FEATURES: 'DEPRECATE_TEMPLATE_ACTION' + + jobs: lint: name: Linting diff --git a/packages/@ember/-internals/deprecations/index.ts b/packages/@ember/-internals/deprecations/index.ts index 33dc91a155a..c3ed54143fe 100644 --- a/packages/@ember/-internals/deprecations/index.ts +++ b/packages/@ember/-internals/deprecations/index.ts @@ -97,6 +97,15 @@ export const DEPRECATIONS = { until: '6.0.0', url: 'https://deprecations.emberjs.com/v5.x/#toc_deprecate-implicit-route-model', }), + DEPRECATE_TEMPLATE_ACTION: deprecation({ + id: 'template-action', + url: 'https://deprecations.emberjs.com/id/template-action', + until: '6.0.0', + for: 'ember-source', + since: { + available: '5.9.0', + }, + }), }; export function deprecateUntil(message: string, deprecation: DeprecationObject) { diff --git a/packages/@ember/-internals/glimmer/lib/helpers/action.ts b/packages/@ember/-internals/glimmer/lib/helpers/action.ts index 8f2423972ab..015cea88b24 100644 --- a/packages/@ember/-internals/glimmer/lib/helpers/action.ts +++ b/packages/@ember/-internals/glimmer/lib/helpers/action.ts @@ -4,6 +4,7 @@ import { get } from '@ember/-internals/metal'; import type { AnyFn } from '@ember/-internals/utility-types'; import { assert } from '@ember/debug'; +import { DEPRECATIONS, deprecateUntil } from '@ember/-internals/deprecations'; import { flaggedInstrument } from '@ember/instrumentation'; import { join } from '@ember/runloop'; import { DEBUG } from '@glimmer/env'; @@ -278,6 +279,10 @@ export const ACTIONS = new WeakSet(); @public */ export default internalHelper((args: CapturedArguments): Reference => { + deprecateUntil( + `Usage of the \`(action)\` helper is deprecated. Migrate to native functions and function invocation.`, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION + ); let { named, positional } = args; // The first two argument slots are reserved. // pos[0] is the context (or `this`) diff --git a/packages/@ember/-internals/glimmer/lib/modifiers/action.ts b/packages/@ember/-internals/glimmer/lib/modifiers/action.ts index 249eaeb9436..66da57e79dc 100644 --- a/packages/@ember/-internals/glimmer/lib/modifiers/action.ts +++ b/packages/@ember/-internals/glimmer/lib/modifiers/action.ts @@ -1,4 +1,5 @@ import type { InternalOwner } from '@ember/-internals/owner'; +import { DEPRECATIONS, deprecateUntil } from '@ember/-internals/deprecations'; import { uuid } from '@ember/-internals/utils'; import { ActionManager, EventDispatcher, isSimpleClick } from '@ember/-internals/views'; import { assert } from '@ember/debug'; @@ -204,6 +205,10 @@ class ActionModifierManager implements InternalModifierManager` when is pressed']( assert ) { - assert.expect(2); + assert.expect(3); + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(``, { actions: { @@ -300,7 +305,11 @@ moduleFor( } ['@test sends `insert-newline` when is pressed'](assert) { - assert.expect(2); + assert.expect(3); + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(``, { actions: { @@ -319,7 +328,11 @@ moduleFor( ['@test sends an action with `` when is pressed']( assert ) { - assert.expect(2); + assert.expect(3); + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(``, { actions: { diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js index 1e8c4589cd9..0d9334250ab 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js @@ -1,6 +1,7 @@ import { RenderingTestCase, moduleFor, runDestroy, runTask } from 'internal-test-helpers'; import { set } from '@ember/object'; +import { DEPRECATIONS } from '../../../../deprecations'; class InputRenderingTest extends RenderingTestCase { $input() { @@ -152,7 +153,11 @@ moduleFor( ['@test sends an action with `{{input enter=(action "foo")}}` when is pressed']( assert ) { - assert.expect(2); + assert.expect(3); + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(`{{input enter=(action 'foo')}}`, { actions: { @@ -169,7 +174,11 @@ moduleFor( } ['@test sends `insert-newline` when is pressed'](assert) { - assert.expect(2); + assert.expect(3); + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(`{{input insert-newline=(action 'foo')}}`, { actions: { @@ -188,7 +197,11 @@ moduleFor( ['@test sends an action with `{{input escape-press=(action "foo")}}` when is pressed']( assert ) { - assert.expect(2); + assert.expect(3); + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(`{{input escape-press=(action 'foo')}}`, { actions: { diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-angle-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-angle-test.js index 259cfe15b6d..eae9d9372b5 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-angle-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-angle-test.js @@ -13,6 +13,7 @@ import { service } from '@ember/service'; import Engine from '@ember/engine'; import { DEBUG } from '@glimmer/env'; import { compile } from '../../../utils/helpers'; +import { DEPRECATIONS } from '../../../../../deprecations'; // IE includes the host name function normalizeUrl(url) { @@ -1027,6 +1028,10 @@ moduleFor( } async ['@test it defaults to bubbling'](assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.addTemplate( 'about', ` diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-curly-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-curly-test.js index 86deedf092f..fb1e8441511 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-curly-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-curly-test.js @@ -13,6 +13,7 @@ import { service } from '@ember/service'; import Engine from '@ember/engine'; import { DEBUG } from '@glimmer/env'; import { compile } from '../../../utils/helpers'; +import { DEPRECATIONS } from '../../../../../deprecations'; // IE includes the host name function normalizeUrl(url) { @@ -1097,6 +1098,11 @@ moduleFor( } async ['@test it defaults to bubbling'](assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + this.addTemplate( 'about', ` diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/tracked-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/tracked-test.js index 8a17d5d007b..45be3d38565 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/tracked-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/tracked-test.js @@ -8,6 +8,7 @@ import { Promise } from 'rsvp'; import { moduleFor, RenderingTestCase, strip, runTask } from 'internal-test-helpers'; import GlimmerishComponent from '../../utils/glimmerish-component'; import { Component } from '../../utils/helpers'; +import { DEPRECATIONS } from '../../../../deprecations'; moduleFor( 'Component Tracked Properties', @@ -136,6 +137,11 @@ moduleFor( } '@test tracked properties that are uninitialized do not throw an error'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let CountComponent = Component.extend({ count: tracked(), @@ -162,6 +168,11 @@ moduleFor( } '@test tracked properties rerender when updated'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let CountComponent = Component.extend({ count: tracked({ value: 0 }), @@ -185,6 +196,11 @@ moduleFor( } '@test tracked properties rerender when updated outside of a runloop'(assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let done = assert.async(); let CountComponent = Component.extend({ @@ -216,6 +232,11 @@ moduleFor( } '@test nested tracked properties rerender when updated'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let Counter = EmberObject.extend({ count: tracked({ value: 0 }), }); @@ -243,6 +264,11 @@ moduleFor( } '@test array properties rerender when updated'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let NumListComponent = Component.extend({ numbers: tracked({ initializer: () => A([1, 2, 3]) }), @@ -270,6 +296,11 @@ moduleFor( } '@test getters update when dependent properties are invalidated'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let CountComponent = Component.extend({ count: tracked({ value: 0 }), @@ -299,6 +330,11 @@ moduleFor( } '@test getters update when dependent computeds are invalidated'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let CountComponent = Component.extend({ _count: 0, @@ -340,6 +376,11 @@ moduleFor( } '@test nested getters update when dependent properties are invalidated'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let Counter = EmberObject.extend({ count: tracked({ value: 0 }), @@ -373,6 +414,11 @@ moduleFor( } '@test tracked object passed down through components updates correctly'(assert) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let Person = EmberObject.extend({ first: tracked({ value: 'Rob' }), last: tracked({ value: 'Jackson' }), @@ -423,6 +469,11 @@ moduleFor( } '@test yielded getters update correctly'() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let PersonComponent = Component.extend({ first: tracked({ value: 'Rob' }), last: tracked({ value: 'Jackson' }), @@ -462,6 +513,11 @@ moduleFor( } '@test yielded nested getters update correctly'() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let Person = EmberObject.extend({ first: tracked({ value: 'Rob' }), last: tracked({ value: 'Jackson' }), @@ -587,6 +643,11 @@ moduleFor( '@test downstream property changes do not invalidate upstream component getters/arguments'( assert ) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let outerRenderCount = 0; let innerRenderCount = 0; diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/utils-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/utils-test.js index af536c1d7b7..a89d3d237a1 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/utils-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/utils-test.js @@ -10,6 +10,7 @@ import { } from '@ember/-internals/views'; import { Component } from '../../utils/helpers'; +import { DEPRECATIONS } from '../../../../deprecations'; moduleFor( 'View tree tests', @@ -49,6 +50,11 @@ moduleFor( }, }); + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + this.add('controller:application', ToggleController); this.addTemplate( diff --git a/packages/@ember/-internals/glimmer/tests/integration/event-dispatcher-test.js b/packages/@ember/-internals/glimmer/tests/integration/event-dispatcher-test.js index c665be30561..e682e7b6563 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/event-dispatcher-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/event-dispatcher-test.js @@ -2,6 +2,7 @@ import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers'; import { Component } from '../utils/helpers'; import { _getCurrentRunLoop } from '@ember/runloop'; +import { DEPRECATIONS } from '../../../deprecations'; let canDataTransfer = Boolean(document.createEvent('HTMLEvents').dataTransfer); @@ -134,6 +135,11 @@ moduleFor( } ['@test case insensitive events'](assert) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let receivedEvent; this.registerComponent('x-bar', { @@ -153,6 +159,10 @@ moduleFor( } ['@test case sensitive events'](assert) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let receivedEvent; this.registerComponent('x-bar', { diff --git a/packages/@ember/-internals/glimmer/tests/integration/helpers/closure-action-test.js b/packages/@ember/-internals/glimmer/tests/integration/helpers/closure-action-test.js index 491ec966116..626a0394ea5 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/helpers/closure-action-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/helpers/closure-action-test.js @@ -4,11 +4,17 @@ import { _getCurrentRunLoop } from '@ember/runloop'; import { set, computed } from '@ember/object'; import { Component } from '../../utils/helpers'; +import { DEPRECATIONS } from '../../../../deprecations'; moduleFor( 'Helpers test: closure {{action}}', class extends RenderingTestCase { ['@test action should be called']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let outerActionCalled = false; let component; @@ -47,6 +53,11 @@ moduleFor( } ['@test an error is triggered when bound action function is undefined']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + this.registerComponent('inner-component', { template: 'inner', }); @@ -60,6 +71,11 @@ moduleFor( } ['@test an error is triggered when bound action being passed in is a non-function']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + this.registerComponent('inner-component', { template: 'inner', }); @@ -76,6 +92,15 @@ moduleFor( } ['@test [#12718] a nice error is shown when a bound action function is undefined and it is passed as @foo']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + this.registerComponent('inner-component', { template: '', @@ -91,6 +116,11 @@ moduleFor( } ['@test action value is returned']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let expectedValue = 'terrible tom'; let returnedValue; let innerComponent; @@ -131,6 +161,11 @@ moduleFor( } ['@test action should be called on the correct scope']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let innerComponent; let outerComponent; let actualComponent; @@ -177,6 +212,11 @@ moduleFor( } ['@test arguments to action are passed, curry']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let first = 'mitch'; let second = 'martin'; let third = 'matt'; @@ -226,6 +266,11 @@ moduleFor( } ['@test `this` can be passed as an argument']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let value = {}; let component; let innerComponent; @@ -271,6 +316,11 @@ moduleFor( } ['@test arguments to action are bound']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let value = 'lazy leah'; let innerComponent; @@ -328,6 +378,11 @@ moduleFor( } ['@test array arguments are passed correctly to action']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let first = 'foo'; let second = [3, 5]; let third = [4, 9]; @@ -388,6 +443,11 @@ moduleFor( } ['@test mut values can be wrapped in actions, are settable']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let newValue = 'trollin trek'; let innerComponent; @@ -431,6 +491,11 @@ moduleFor( } ['@test mut values can be wrapped in actions, are settable with a curry']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let newValue = 'trollin trek'; let innerComponent; @@ -474,6 +539,11 @@ moduleFor( } ['@test action can create closures over actions']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let first = 'raging robert'; let second = 'mild machty'; let returnValue = 'butch brian'; @@ -526,6 +596,11 @@ moduleFor( } ['@test provides a helpful error if an action is not present']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let InnerComponent = Component.extend({}); let OuterComponent = Component.extend({ @@ -554,6 +629,11 @@ moduleFor( } ['@test provides a helpful error if actions hash is not present']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let InnerComponent = Component.extend({}); let OuterComponent = Component.extend({}); @@ -574,6 +654,11 @@ moduleFor( } ['@test action can create closures over actions with target']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let innerComponent; let actionCalled = false; @@ -619,6 +704,11 @@ moduleFor( } ['@test value can be used with action over actions']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let newValue = 'yelping yehuda'; let innerComponent; @@ -667,6 +757,11 @@ moduleFor( } ['@test action will read the value of a first property']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let newValue = 'irate igor'; let innerComponent; @@ -710,6 +805,11 @@ moduleFor( } ['@test action will read the value of a curried first argument property']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let newValue = 'kissing kris'; let innerComponent; @@ -754,6 +854,11 @@ moduleFor( } ['@test action closure does not get auto-mut wrapped'](assert) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let first = 'raging robert'; let second = 'mild machty'; let returnValue = 'butch brian'; @@ -823,6 +928,11 @@ moduleFor( } ['@test action should be called within a run loop']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let innerComponent; let capturedRunLoop; @@ -864,6 +974,11 @@ moduleFor( } ['@test closure action with `(mut undefinedThing)` works properly [GH#13959]']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let component; let ExampleComponent = Component.extend({ @@ -914,6 +1029,11 @@ moduleFor( ['@test closure actions does not cause component hooks to fire unnecessarily [GH#14305] [GH#14654]']( assert ) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let clicked = 0; let didReceiveAttrsFired = 0; diff --git a/packages/@ember/-internals/glimmer/tests/integration/helpers/element-action-test.js b/packages/@ember/-internals/glimmer/tests/integration/helpers/element-action-test.js index d5b0728a0ed..72fa6f73f83 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/helpers/element-action-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/helpers/element-action-test.js @@ -5,6 +5,7 @@ import { A as emberA } from '@ember/array'; import { ActionManager } from '@ember/-internals/views'; import { Component } from '../../utils/helpers'; +import { DEPRECATIONS } from '../../../../deprecations'; function getActionAttributes(element) { let attributes = element.attributes; @@ -31,6 +32,11 @@ moduleFor( 'Helpers test: element action', class extends RenderingTestCase { ['@test it can call an action on its enclosing component']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let fooCallCount = 0; let ExampleComponent = Component.extend({ @@ -68,6 +74,11 @@ moduleFor( } ['@test it can call an action with parameters']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let fooArgs = []; let component; @@ -115,6 +126,11 @@ moduleFor( } ['@test it should output a marker attribute with a guid']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + this.render(''); let button = this.$('button'); @@ -132,6 +148,11 @@ moduleFor( } ['@test it should allow alternative events to be handled']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let showCalled = false; let ExampleComponent = Component.extend({ @@ -157,6 +178,11 @@ moduleFor( } ['@test inside a yield, the target points at the original target']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let targetWatted = false; let innerWatted = false; @@ -201,6 +227,11 @@ moduleFor( } ['@test it should allow a target to be specified']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let targetWatted = false; let TargetComponent = Component.extend({ @@ -237,6 +268,11 @@ moduleFor( } ['@test it should lazily evaluate the target']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let firstEdit = 0; let secondEdit = 0; let component; @@ -287,6 +323,11 @@ moduleFor( } ['@test it should register an event handler']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let shortcutHandlerWasCalled = false; @@ -327,6 +368,11 @@ moduleFor( } ['@test it handles whitelisted bound modifier keys']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let shortcutHandlerWasCalled = false; @@ -369,6 +415,11 @@ moduleFor( } ['@test it handles whitelisted bound modifier keys with current value']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let component; @@ -412,6 +463,11 @@ moduleFor( } ['@test should be able to use action more than once for the same event within a view']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let deleteHandlerWasCalled = false; let originalHandlerWasCalled = false; @@ -481,6 +537,11 @@ moduleFor( } ['@test the event should not bubble if `bubbles=false` is passed']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let deleteHandlerWasCalled = false; let originalHandlerWasCalled = false; @@ -542,6 +603,11 @@ moduleFor( } ['@test the event should not bubble if `bubbles=false` is passed bound']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let deleteHandlerWasCalled = false; let originalHandlerWasCalled = false; @@ -604,6 +670,11 @@ moduleFor( } ['@test the bubbling depends on the bound parameter']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let originalHandlerWasCalled = false; let component; @@ -653,6 +724,11 @@ moduleFor( } ['@test multiple actions with bubbles=false for same event are called but prevent bubbling']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let clickAction1WasCalled = false; let clickAction2WasCalled = false; let eventHandlerWasCalled = false; @@ -692,6 +768,11 @@ moduleFor( } ['@test it should work properly in an #each block']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let ExampleComponent = Component.extend({ @@ -719,6 +800,11 @@ moduleFor( } ['@test it should work properly in a {{#let foo as |bar|}} block']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let ExampleComponent = Component.extend({ @@ -746,6 +832,11 @@ moduleFor( } ['@test it should unregister event handlers when an element action is removed'](assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let ExampleComponent = Component.extend({ actions: { edit() {}, @@ -791,6 +882,11 @@ moduleFor( } ['@test it should capture events from child elements and allow them to trigger the action']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let ExampleComponent = Component.extend({ @@ -819,6 +915,11 @@ moduleFor( } ['@test it should allow bubbling of events from action helper to original parent event']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let originalHandlerWasCalled = false; @@ -851,6 +952,11 @@ moduleFor( } ['@test it should not bubble an event from action helper to original parent event if `bubbles=false` is passed']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let originalHandlerWasCalled = false; @@ -881,6 +987,11 @@ moduleFor( } ['@test it should allow "send" as the action name (#594)']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let sendHandlerWasCalled = false; let ExampleComponent = Component.extend({ @@ -906,6 +1017,11 @@ moduleFor( } ['@test it should send the view, event, and current context to the action']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let passedTarget; let passedContext; let targetThis; @@ -957,6 +1073,11 @@ moduleFor( } ['@test it should only trigger actions for the event they were registered on']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let editHandlerWasCalled = false; let ExampleComponent = Component.extend({ @@ -990,6 +1111,11 @@ moduleFor( } ['@test it should allow multiple contexts to be specified']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let passedContexts; let models = [EmberObject.create(), EmberObject.create()]; @@ -1022,6 +1148,11 @@ moduleFor( } ['@test it should allow multiple contexts to be specified mixed with string args']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let passedContexts; let model = EmberObject.create(); @@ -1053,6 +1184,11 @@ moduleFor( } ['@test it should not trigger action with special clicks']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let showCalled = false; let component; @@ -1104,6 +1240,11 @@ moduleFor( } ['@test it can trigger actions for keyboard events']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let showCalled = false; let ExampleComponent = Component.extend({ @@ -1129,6 +1270,11 @@ moduleFor( } ['@test a quoteless parameter should allow dynamic lookup of the actionName']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let lastAction; let actionOrder = []; let component; @@ -1188,6 +1334,11 @@ moduleFor( } ['@test a quoteless string parameter should resolve actionName, including path']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let lastAction; let actionOrder = []; let component; @@ -1248,6 +1399,11 @@ moduleFor( } ['@test a quoteless function parameter should be called, including arguments']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let submitCalled = false; let incomingArg; @@ -1276,6 +1432,11 @@ moduleFor( } ['@test a quoteless parameter that does not resolve to a value asserts']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let ExampleComponent = Component.extend({ actions: { ohNoeNotValid() {}, @@ -1293,6 +1454,11 @@ moduleFor( } ['@test allows multiple actions on a single element']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let clickActionWasCalled = false; let doubleClickActionWasCalled = false; @@ -1332,6 +1498,11 @@ moduleFor( } ['@test allows multiple actions for same event on a single element']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let clickAction1WasCalled = false; let clickAction2WasCalled = false; @@ -1366,6 +1537,11 @@ moduleFor( } ['@test it should respect preventDefault option if provided']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let ExampleComponent = Component.extend({ actions: { show() {}, @@ -1389,6 +1565,11 @@ moduleFor( } ['@test it should respect preventDefault option if provided bound']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let component; let ExampleComponent = Component.extend({ @@ -1426,6 +1607,11 @@ moduleFor( } ['@test it should target the proper component when `action` is in yielded block [GH #12409]']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let outerActionCalled = false; let innerClickCalled = false; @@ -1479,6 +1665,11 @@ moduleFor( } ['@test element action with (mut undefinedThing) works properly']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let component; let ExampleComponent = Component.extend({ @@ -1527,6 +1718,11 @@ moduleFor( } ['@test it supports non-registered actions [GH#14888]']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + this.render( ` {{#if this.show}} @@ -1547,6 +1743,11 @@ moduleFor( } ["@test action handler that shifts element attributes doesn't trigger multiple invocations"]() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let actionCount = 0; let ExampleComponent = Component.extend({ selected: false, diff --git a/packages/@ember/-internals/glimmer/tests/integration/helpers/fn-test.js b/packages/@ember/-internals/glimmer/tests/integration/helpers/fn-test.js index a2aa0b74eda..ead9cdb2dca 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/helpers/fn-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/helpers/fn-test.js @@ -2,6 +2,7 @@ import { set } from '@ember/object'; import { DEBUG } from '@glimmer/env'; import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers'; import { Component } from '../../utils/helpers'; +import { DEPRECATIONS } from '../../../../deprecations'; moduleFor( 'Helpers test: {{fn}}', @@ -135,6 +136,10 @@ moduleFor( } '@test can use `this` if bound prior to passing to fn'(assert) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(`{{stash stashedFn=(fn (action this.myFunc) this.arg1)}}`, { myFunc(arg1) { return `arg1: ${arg1}, arg2: ${this.arg2}`; diff --git a/packages/@ember/-internals/glimmer/tests/integration/helpers/readonly-test.js b/packages/@ember/-internals/glimmer/tests/integration/helpers/readonly-test.js index aa6415d37cc..81937c7d8dd 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/helpers/readonly-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/helpers/readonly-test.js @@ -3,6 +3,7 @@ import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers'; import { set, get } from '@ember/object'; import { Component } from '../../utils/helpers'; +import { DEPRECATIONS } from '../../../../deprecations'; moduleFor( 'Helpers test: {{readonly}}', @@ -37,7 +38,12 @@ moduleFor( } '@test passing an action to {{readonly}} avoids mutable cell wrapping'(assert) { - assert.expect(4); + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + + assert.expect(5); let outer, inner; this.registerComponent('x-inner', { diff --git a/packages/@ember/-internals/glimmer/tests/integration/helpers/tracked-test.js b/packages/@ember/-internals/glimmer/tests/integration/helpers/tracked-test.js index 8fe282cbbbc..e196e1e4163 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/helpers/tracked-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/helpers/tracked-test.js @@ -10,11 +10,16 @@ import Service, { service } from '@ember/service'; import { moduleFor, RenderingTestCase, strip, runTask } from 'internal-test-helpers'; import { Component } from '../../utils/helpers'; +import { DEPRECATIONS } from '../../../../deprecations'; moduleFor( 'Helper Tracked Properties', class extends RenderingTestCase { '@test tracked properties rerender when updated'(assert) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let computeCount = 0; let PersonComponent = Component.extend({ @@ -92,6 +97,10 @@ moduleFor( } '@test getters update when dependent properties are invalidated'(assert) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let computeCount = 0; let PersonComponent = Component.extend({ @@ -144,6 +153,10 @@ moduleFor( } '@test array properties rerender when updated'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let NumListComponent = Component.extend({ numbers: tracked({ initializer: () => A([1, 2, 3]) }), @@ -175,6 +188,10 @@ moduleFor( } '@test custom ember array properties rerender when updated'() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let CustomArray = EmberObject.extend(MutableArray, { init() { this._super(...arguments); diff --git a/packages/@ember/-internals/glimmer/tests/integration/input-test.js b/packages/@ember/-internals/glimmer/tests/integration/input-test.js index 731a01763b8..87aa1668219 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/input-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/input-test.js @@ -1,4 +1,5 @@ import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers'; +import { DEPRECATIONS } from '../../../deprecations'; import { set } from '@ember/object'; @@ -202,6 +203,10 @@ moduleFor( } ['@test GH18211 input checked attribute, without a value, works with the action helper']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(``, { actions: { someAction() {} }, }); @@ -209,6 +214,10 @@ moduleFor( } ['@test GH18211 input checked attribute, with a value, works with the action helper']() { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(``, { actions: { someAction() {} }, }); @@ -216,6 +225,10 @@ moduleFor( } ['@test GH18211 input checked attribute, without a value, works with attributes with values']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(``, { actions: { someAction() {} }, }); @@ -223,6 +236,10 @@ moduleFor( } ['@test GH18211 input checked attribute, without a value, works with event attributes']() { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.render(``, { actions: { someAction() {} }, }); diff --git a/packages/@ember/application/tests/visit_test.js b/packages/@ember/application/tests/visit_test.js index 7b0887c28a7..f4ad9ed133c 100644 --- a/packages/@ember/application/tests/visit_test.js +++ b/packages/@ember/application/tests/visit_test.js @@ -15,6 +15,7 @@ import Route from '@ember/routing/route'; import { Component, helper, isSerializationFirstNode } from '@ember/-internals/glimmer'; import { compile } from 'ember-template-compiler'; import { ENV } from '@ember/-internals/environment'; +import { DEPRECATIONS } from '@ember/-internals/deprecations'; function expectAsyncError() { RSVP.off('error'); @@ -625,6 +626,10 @@ moduleFor( } [`@test Ember Islands-style setup`](assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let xFooInitCalled = false; let xFooDidInsertElementCalled = false; diff --git a/packages/@ember/canary-features/index.ts b/packages/@ember/canary-features/index.ts index 89132270986..469bbaa7ffc 100644 --- a/packages/@ember/canary-features/index.ts +++ b/packages/@ember/canary-features/index.ts @@ -62,5 +62,3 @@ export function isEnabled(feature: string): boolean { // return value; // } - -// export const FLAG_NAME = featureValue(FEATURES.FLAG_NAME); diff --git a/packages/@ember/object/tests/action_test.js b/packages/@ember/object/tests/action_test.js index 8acc0dca4de..59be6c64251 100644 --- a/packages/@ember/object/tests/action_test.js +++ b/packages/@ember/object/tests/action_test.js @@ -1,11 +1,17 @@ import { Component } from '@ember/-internals/glimmer'; import EmberObject, { action } from '@ember/object'; import { moduleFor, RenderingTestCase, strip } from 'internal-test-helpers'; +import { DEPRECATIONS } from '@ember/-internals/deprecations'; moduleFor( '@action decorator', class extends RenderingTestCase { '@test action decorator works with ES6 class'(assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + class FooComponent extends Component { @action foo() { @@ -49,7 +55,11 @@ moduleFor( } '@test actions are properly merged through traditional and ES6 prototype hierarchy'(assert) { - assert.expect(4); + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + assert.expect(5); let FooComponent = Component.extend({ actions: { @@ -97,6 +107,11 @@ moduleFor( } '@test action decorator super works with native class methods'(assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + class FooComponent extends Component { foo() { assert.ok(true, 'called!'); @@ -121,6 +136,11 @@ moduleFor( } '@test action decorator super works with traditional class methods'(assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let FooComponent = Component.extend({ foo() { assert.ok(true, 'called!'); @@ -239,6 +259,11 @@ moduleFor( } '@test action decorator can be used as a classic decorator with strings'(assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + let FooComponent = Component.extend({ foo: action(function () { assert.ok(true, 'called!'); diff --git a/packages/ember/tests/component_context_test.js b/packages/ember/tests/component_context_test.js index fa88436a09e..2b8dc62f774 100644 --- a/packages/ember/tests/component_context_test.js +++ b/packages/ember/tests/component_context_test.js @@ -1,6 +1,7 @@ import Controller from '@ember/controller'; import { Component } from '@ember/-internals/glimmer'; import { moduleFor, ApplicationTestCase, getTextOf } from 'internal-test-helpers'; +import { DEPRECATIONS } from '@ember/-internals/deprecations'; moduleFor( 'Application Lifecycle - Component Context', @@ -186,6 +187,10 @@ moduleFor( ['@test Components trigger actions in the parents context when called from within a block']( assert ) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.addTemplate( 'application', ` @@ -219,6 +224,10 @@ moduleFor( ['@test Components trigger actions in the components context when called from within its template']( assert ) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.addTemplate( 'application', ` diff --git a/packages/ember/tests/controller_test.js b/packages/ember/tests/controller_test.js index 26c8a020a94..ecb19bf319c 100644 --- a/packages/ember/tests/controller_test.js +++ b/packages/ember/tests/controller_test.js @@ -1,6 +1,7 @@ import Controller from '@ember/controller'; import { moduleFor, ApplicationTestCase, runTask } from 'internal-test-helpers'; import { Component } from '@ember/-internals/glimmer'; +import { DEPRECATIONS } from '@ember/-internals/deprecations'; /* In Ember 1.x, controllers subtly affect things like template scope @@ -14,6 +15,10 @@ moduleFor( 'Template scoping examples', class extends ApplicationTestCase { ['@test Actions inside an outlet go to the associated controller'](assert) { + expectDeprecation( + /Usage of the `\(action\)` helper is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.add( 'controller:index', Controller.extend({ diff --git a/packages/ember/tests/integration/multiple-app-test.js b/packages/ember/tests/integration/multiple-app-test.js index b151999936a..9ffad291a16 100644 --- a/packages/ember/tests/integration/multiple-app-test.js +++ b/packages/ember/tests/integration/multiple-app-test.js @@ -3,6 +3,7 @@ import Application from '@ember/application'; import { Component } from '@ember/-internals/glimmer'; import { getOwner } from '@ember/-internals/owner'; import { resolve } from 'rsvp'; +import { DEPRECATIONS } from '@ember/-internals/deprecations'; moduleFor( 'View Integration', @@ -82,6 +83,10 @@ moduleFor( } [`@test booting multiple applications can properly handle events`](assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let actions = []; this.addFactoriesToResolver(actions, this.resolver); this.addFactoriesToResolver(actions, this.secondResolver); diff --git a/packages/ember/tests/routing/decoupled_basic_test.js b/packages/ember/tests/routing/decoupled_basic_test.js index 9e1888876d4..1a716f21339 100644 --- a/packages/ember/tests/routing/decoupled_basic_test.js +++ b/packages/ember/tests/routing/decoupled_basic_test.js @@ -6,6 +6,7 @@ import Route from '@ember/routing/route'; import NoneLocation from '@ember/routing/none-location'; import HistoryLocation from '@ember/routing/history-location'; import Controller from '@ember/controller'; +import { DEPRECATIONS } from '@ember/-internals/deprecations'; import EmberObject, { set } from '@ember/object'; import { moduleFor, @@ -296,6 +297,10 @@ moduleFor( async ['@test Events are triggered on the controller if a matching action name is implemented']( assert ) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let done = assert.async(); this.router.map(function () { @@ -342,6 +347,10 @@ moduleFor( async ['@test Events are triggered on the current state when defined in `actions` object']( assert ) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let done = assert.async(); this.router.map(function () { @@ -378,6 +387,10 @@ moduleFor( async ['@test Events defined in `actions` object are triggered on the current state when routes are nested']( assert ) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let done = assert.async(); this.router.map(function () { @@ -419,7 +432,11 @@ moduleFor( } ['@test Events can be handled by inherited event handlers'](assert) { - assert.expect(4); + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + assert.expect(5); let SuperRoute = Route.extend({ actions: { @@ -471,6 +488,10 @@ moduleFor( async ['@test Actions are not triggered on the controller if a matching action name is implemented as a method']( assert ) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let done = assert.async(); this.router.map(function () { @@ -515,6 +536,10 @@ moduleFor( } async ['@test actions can be triggered with multiple arguments'](assert) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); let done = assert.async(); this.router.map(function () { this.route('root', { path: '/' }, function () { @@ -1213,7 +1238,11 @@ moduleFor( } ['@test Actions can be handled by inherited action handlers'](assert) { - assert.expect(4); + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); + assert.expect(5); let SuperRoute = Route.extend({ actions: { diff --git a/packages/ember/tests/routing/query_params_test.js b/packages/ember/tests/routing/query_params_test.js index 4f820f86996..43c12e3799a 100644 --- a/packages/ember/tests/routing/query_params_test.js +++ b/packages/ember/tests/routing/query_params_test.js @@ -8,6 +8,7 @@ import { peekMeta } from '@ember/-internals/meta'; import { tracked } from '@ember/-internals/metal'; import Route from '@ember/routing/route'; import { PARAMS_SYMBOL } from 'router_js'; +import { DEPRECATIONS } from '@ember/-internals/deprecations'; import { service } from '@ember/service'; import { QueryParamTestCase, moduleFor, getTextOf, runLoopSettled } from 'internal-test-helpers'; @@ -743,6 +744,10 @@ moduleFor( async ['@test queryParams are updated when a controller property is set and the route is refreshed. Issue #13263 ']( assert ) { + expectDeprecation( + /Usage of the `\{\{action\}\}` modifier is deprecated./, + DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled + ); this.addTemplate( 'application', '{{this.foo}}{{outlet}}'