Skip to content

Commit

Permalink
Add expectDeprecation to tests to mark places that will need updating…
Browse files Browse the repository at this point in the history
… when we remove action
  • Loading branch information
NullVoxPopuli committed Mar 9, 2024
1 parent f963f70 commit 0518131
Show file tree
Hide file tree
Showing 24 changed files with 228 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ moduleFor(
constructor() {
setDebugFunction('debug', noop);
super(...arguments);

expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);
}

teardown() {
Expand All @@ -23,7 +25,7 @@ moduleFor(
['@test actions in top level template application template target application controller'](
assert
) {
assert.expect(1);
assert.expect(2);

this.add(
'controller:application',
Expand All @@ -47,7 +49,7 @@ moduleFor(
}

['@test actions in nested outlet template target their controller'](assert) {
assert.expect(1);
assert.expect(2);

this.add(
'controller:application',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ moduleFor(
}

['@test renders with dot path and updates attributes'](assert) {
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

this.registerComponent('my-nested-component', {
ComponentClass: Component.extend({
didReceiveAttrs() {
Expand Down Expand Up @@ -839,6 +841,8 @@ moduleFor(
['@test parameters in a contextual component are mutable when value is a param'](assert) {
// This checks that a `(mut)` is added to parameters and attributes to
// contextual components when it is a param.
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

this.registerComponent('change-button', {
ComponentClass: Component.extend().reopenClass({
Expand Down Expand Up @@ -889,6 +893,7 @@ moduleFor(
}

['@test GH#13494 tagless blockless component with property binding'](assert) {
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);
this.registerComponent('outer-component', {
ComponentClass: Component.extend({
message: 'hello',
Expand Down Expand Up @@ -1442,6 +1447,8 @@ class MutableParamTestGenerator {
generate({ title, setup }) {
return {
[`@test parameters in a contextual component are mutable when value is a ${title}`](assert) {
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);
this.registerComponent('change-button', {
ComponentClass: Component.extend().reopenClass({
positionalParams: ['val'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,8 @@ moduleFor(
) {
let componentInstance = null;

expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

this.registerComponent('non-block', {
ComponentClass: Component.extend({
counter: computed({
Expand Down Expand Up @@ -3149,6 +3151,8 @@ moduleFor(
['@test returning `true` from an action does not bubble if `target` is not specified (GH#14275)'](
assert
) {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

this.registerComponent('display-toggle', {
ComponentClass: Component.extend({
actions: {
Expand All @@ -3174,7 +3178,9 @@ moduleFor(
}

['@test returning `true` from an action bubbles to the `target` if specified'](assert) {
assert.expect(4);
assert.expect(5);

expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

this.registerComponent('display-toggle', {
ComponentClass: Component.extend({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ moduleFor(
}),
});

expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

let actionTriggered = 0;
this.registerComponent('outer-component', {
template:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ moduleFor(
['@test sends an action with `<Input @enter={{action "foo"}} />` when <enter> is pressed'](
assert
) {
assert.expect(2);
assert.expect(3);
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

this.render(`<Input @enter={{action 'foo'}} />`, {
actions: {
Expand All @@ -300,7 +301,8 @@ moduleFor(
}

['@test sends `insert-newline` when <enter> is pressed'](assert) {
assert.expect(2);
assert.expect(3);
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

this.render(`<Input @insert-newline={{action 'foo'}} />`, {
actions: {
Expand All @@ -319,7 +321,8 @@ moduleFor(
['@test sends an action with `<Input @escape-press={{action "foo"}} />` when <escape> is pressed'](
assert
) {
assert.expect(2);
assert.expect(3);
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

this.render(`<Input @escape-press={{action 'foo'}} />`, {
actions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ moduleFor(
['@test sends an action with `{{input enter=(action "foo")}}` when <enter> is pressed'](
assert
) {
assert.expect(2);
assert.expect(3);
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

this.render(`{{input enter=(action 'foo')}}`, {
actions: {
Expand All @@ -169,7 +170,8 @@ moduleFor(
}

['@test sends `insert-newline` when <enter> is pressed'](assert) {
assert.expect(2);
assert.expect(3);
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

this.render(`{{input insert-newline=(action 'foo')}}`, {
actions: {
Expand All @@ -188,7 +190,8 @@ moduleFor(
['@test sends an action with `{{input escape-press=(action "foo")}}` when <escape> is pressed'](
assert
) {
assert.expect(2);
assert.expect(3);
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

this.render(`{{input escape-press=(action 'foo')}}`, {
actions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ moduleFor(
}

async ['@test it defaults to bubbling'](assert) {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);
this.addTemplate(
'about',
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,8 @@ moduleFor(
}

async ['@test it defaults to bubbling'](assert) {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

this.addTemplate(
'about',
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ moduleFor(
}

'@test tracked properties that are uninitialized do not throw an error'() {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let CountComponent = Component.extend({
count: tracked(),

Expand All @@ -162,6 +164,8 @@ moduleFor(
}

'@test tracked properties rerender when updated'() {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let CountComponent = Component.extend({
count: tracked({ value: 0 }),

Expand All @@ -185,6 +189,8 @@ moduleFor(
}

'@test tracked properties rerender when updated outside of a runloop'(assert) {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let done = assert.async();

let CountComponent = Component.extend({
Expand Down Expand Up @@ -216,6 +222,8 @@ moduleFor(
}

'@test nested tracked properties rerender when updated'() {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let Counter = EmberObject.extend({
count: tracked({ value: 0 }),
});
Expand Down Expand Up @@ -243,6 +251,8 @@ moduleFor(
}

'@test array properties rerender when updated'() {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let NumListComponent = Component.extend({
numbers: tracked({ initializer: () => A([1, 2, 3]) }),

Expand Down Expand Up @@ -270,6 +280,8 @@ moduleFor(
}

'@test getters update when dependent properties are invalidated'() {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let CountComponent = Component.extend({
count: tracked({ value: 0 }),

Expand Down Expand Up @@ -299,6 +311,8 @@ moduleFor(
}

'@test getters update when dependent computeds are invalidated'() {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let CountComponent = Component.extend({
_count: 0,

Expand Down Expand Up @@ -340,6 +354,8 @@ moduleFor(
}

'@test nested getters update when dependent properties are invalidated'() {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let Counter = EmberObject.extend({
count: tracked({ value: 0 }),

Expand Down Expand Up @@ -373,6 +389,8 @@ moduleFor(
}

'@test tracked object passed down through components updates correctly'(assert) {
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

let Person = EmberObject.extend({
first: tracked({ value: 'Rob' }),
last: tracked({ value: 'Jackson' }),
Expand Down Expand Up @@ -423,6 +441,8 @@ moduleFor(
}

'@test yielded getters update correctly'() {
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

let PersonComponent = Component.extend({
first: tracked({ value: 'Rob' }),
last: tracked({ value: 'Jackson' }),
Expand Down Expand Up @@ -462,6 +482,8 @@ moduleFor(
}

'@test yielded nested getters update correctly'() {
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

let Person = EmberObject.extend({
first: tracked({ value: 'Rob' }),
last: tracked({ value: 'Jackson' }),
Expand Down Expand Up @@ -587,6 +609,8 @@ moduleFor(
'@test downstream property changes do not invalidate upstream component getters/arguments'(
assert
) {
expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

let outerRenderCount = 0;
let innerRenderCount = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ moduleFor(
},
});

expectDeprecation(/Usage of the `\{\{action\}\}` modifier is deprecated./);

this.add('controller:application', ToggleController);

this.addTemplate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ moduleFor(
}

['@test case insensitive events'](assert) {
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);

let receivedEvent;

this.registerComponent('x-bar', {
Expand All @@ -153,6 +155,7 @@ moduleFor(
}

['@test case sensitive events'](assert) {
expectDeprecation(/Usage of the `\(action\)` helper is deprecated./);
let receivedEvent;

this.registerComponent('x-bar', {
Expand Down
Loading

0 comments on commit 0518131

Please sign in to comment.