Skip to content

Commit 47f3eeb

Browse files
authored
Merge pull request emberjs#20693 from emberjs/kg-fix-run-with-deprecations-enabled
Fix running tests with all deprecations enabled.
2 parents c85fed3 + 6f260cb commit 47f3eeb

File tree

9 files changed

+84
-43
lines changed

9 files changed

+84
-43
lines changed

packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import {
22
ApplicationTestCase,
33
ModuleBasedTestResolver,
4-
expectDeprecation,
54
moduleFor,
65
strip,
7-
testUnless,
86
} from 'internal-test-helpers';
97

108
import { ENV } from '@ember/-internals/environment';
@@ -24,7 +22,6 @@ import type { SimpleElement, SimpleNode } from '@simple-dom/interface';
2422
import type { EmberPrecompileOptions } from 'ember-template-compiler';
2523
import { compile } from 'ember-template-compiler';
2624
import { runTask } from 'internal-test-helpers/lib/run';
27-
import { DEPRECATIONS } from '@ember/-internals/deprecations';
2825
import templateOnly from '@ember/component/template-only';
2926

3027
interface CapturedBounds {
@@ -788,13 +785,7 @@ if (ENV._DEBUG_RENDER_TREE) {
788785
]);
789786
}
790787

791-
async [`${testUnless(
792-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
793-
)} template-only components`]() {
794-
expectDeprecation(
795-
/resolved templates/,
796-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
797-
);
788+
async [`@test template-only components`]() {
798789
this.addTemplate(
799790
'application',
800791
strip`

packages/@ember/-internals/glimmer/tests/integration/components/append-test.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { moduleFor, RenderingTestCase, strip, runTask, testUnless } from 'internal-test-helpers';
1+
import {
2+
moduleFor,
3+
RenderingTestCase,
4+
strip,
5+
runTask,
6+
testUnless,
7+
expectDeprecation,
8+
} from 'internal-test-helpers';
29

310
import { set } from '@ember/object';
411

@@ -284,6 +291,11 @@ class AbstractAppendTest extends RenderingTestCase {
284291
)} lifecycle hooks during component append`](assert) {
285292
let hooks = [];
286293

294+
expectDeprecation(
295+
/resolved templates/,
296+
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
297+
);
298+
287299
let oldRegisterComponent = this.registerComponent;
288300
let componentsByName = {};
289301

@@ -532,6 +544,11 @@ class AbstractAppendTest extends RenderingTestCase {
532544
)} appending, updating and destroying a single component`](assert) {
533545
let willDestroyCalled = 0;
534546

547+
expectDeprecation(
548+
/separately resolved templates/,
549+
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
550+
);
551+
535552
this.registerComponent('x-parent', {
536553
ComponentClass: Component.extend({
537554
layoutName: 'components/x-parent',

packages/@ember/-internals/glimmer/tests/integration/components/component-template-test.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import { DEBUG } from '@glimmer/env';
2-
import {
3-
expectDeprecation,
4-
moduleFor,
5-
RenderingTestCase,
6-
runTask,
7-
testUnless,
8-
} from 'internal-test-helpers';
2+
import { moduleFor, RenderingTestCase, runTask, testUnless } from 'internal-test-helpers';
93

104
import { setComponentTemplate, getComponentTemplate } from '@glimmer/manager';
115
import { Component, compile } from '../../utils/helpers';
@@ -31,8 +25,6 @@ moduleFor(
3125
[`${testUnless(
3226
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
3327
)} it takes precedence over resolver`]() {
34-
expectDeprecation('', DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled);
35-
3628
this.registerComponent('foo-bar', {
3729
ComponentClass: setComponentTemplate(compile('hello'), Component.extend()),
3830
resolveableTemplate: 'noooooo!',

packages/@ember/-internals/glimmer/tests/integration/components/strict-mode-test.js

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
defineSimpleHelper,
77
defineSimpleModifier,
88
testUnless,
9+
expectDeprecation,
910
} from 'internal-test-helpers';
1011

1112
import { Input, Textarea } from '@ember/component';
@@ -268,6 +269,11 @@ moduleFor(
268269
[`${testUnless(DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isRemoved)} Can use action helper`](
269270
assert
270271
) {
272+
expectDeprecation(
273+
/Migrate to native functions/,
274+
DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled
275+
);
276+
271277
let called = 0;
272278

273279
let Foo = defineComponent(
@@ -294,6 +300,11 @@ moduleFor(
294300
[`${testUnless(DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isRemoved)} Can use action modifier`](
295301
assert
296302
) {
303+
expectDeprecation(
304+
/Migrate to native functions/,
305+
DEPRECATIONS.DEPRECATE_TEMPLATE_ACTION.isEnabled
306+
);
307+
297308
let called = 0;
298309

299310
let Foo = defineComponent(

packages/@ember/-internals/glimmer/tests/integration/mount-test.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Engine, { getEngineParent } from '@ember/engine';
1515

1616
import { backtrackingMessageFor } from '../utils/debug-stack';
1717
import { compile, Component } from '../utils/helpers';
18+
import { setComponentTemplate } from '@glimmer/manager';
1819

1920
moduleFor(
2021
'{{mount}} single param assertion',
@@ -142,19 +143,23 @@ moduleFor(
142143
},
143144
});
144145

145-
this.engineRegistrations['template:components/component-with-backtracking-set'] = compile(
146-
'[component {{this.person.name}}]',
147-
{
148-
moduleName: 'my-app/templates/components/component-with-backtracking-set.hbs',
149-
}
150-
);
151-
this.engineRegistrations['component:component-with-backtracking-set'] = Component.extend({
146+
let ComponentWithBacktrackingSet = Component.extend({
152147
init() {
153148
this._super(...arguments);
154149
this.set('person.name', 'Ben');
155150
},
156151
});
157152

153+
setComponentTemplate(
154+
compile('[component {{this.person.name}}]', {
155+
moduleName: 'my-app/templates/components/component-with-backtracking-set.hbs',
156+
}),
157+
ComponentWithBacktrackingSet
158+
);
159+
160+
this.engineRegistrations['component:component-with-backtracking-set'] =
161+
ComponentWithBacktrackingSet;
162+
158163
let expectedBacktrackingMessage = backtrackingMessageFor('name', 'Person \\(Ben\\)', {
159164
renderTree: ['application', 'route-with-mount', 'chat', 'this.person.name'],
160165
});

packages/@ember/-internals/glimmer/tests/unit/runtime-resolver-cache-test.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ moduleFor(
128128
[`${testUnless(
129129
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
130130
)} each template is only compiled once`]() {
131-
expectDeprecation(/msg here/, DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled);
131+
expectDeprecation(
132+
/resolved templates/,
133+
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
134+
);
132135
// static layout
133136
this.registerComponent('component-one', { resolveableTemplate: 'One' });
134137

packages/ember/tests/component_registration_test.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import Application from '@ember/application';
22
import Controller from '@ember/controller';
33
import { Component } from '@ember/-internals/glimmer';
44
import { compile } from 'ember-template-compiler';
5-
import { moduleFor, testUnless, ApplicationTestCase, defineComponent } from 'internal-test-helpers';
5+
import {
6+
moduleFor,
7+
testUnless,
8+
ApplicationTestCase,
9+
defineComponent,
10+
expectDeprecation,
11+
} from 'internal-test-helpers';
612
import { DEBUG } from '@glimmer/env';
713
import { DEPRECATIONS } from '@ember/-internals/deprecations';
814
import templateOnly from '@ember/component/template-only';
@@ -83,6 +89,10 @@ moduleFor(
8389
)} Late-registered components can be rendered with template registered on the container`](
8490
assert
8591
) {
92+
expectDeprecation(
93+
/resolved templates/,
94+
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
95+
);
8696
this.addTemplate(
8797
'application',
8898
`<div id='wrapper'>hello world {{sally-rutherford}}-{{#sally-rutherford}}!!!{{/sally-rutherford}}</div>`
@@ -119,6 +129,11 @@ moduleFor(
119129
)} Late-registered components can be rendered with ONLY the template registered on the container`](
120130
assert
121131
) {
132+
expectDeprecation(
133+
/resolved templates/,
134+
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
135+
);
136+
122137
this.addTemplate(
123138
'application',
124139
`<div id='wrapper'>hello world {{borf-snorlax}}-{{#borf-snorlax}}!!!{{/borf-snorlax}}</div>`

packages/ember/tests/routing/router_service_test/non_application_test_test.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,22 @@ moduleFor(
8282

8383
this.addTemplate('parent.index', '{{foo-bar}}');
8484

85-
this.addComponent('foo-bar', {
86-
ComponentClass: Component.extend({
87-
routerService: service('router'),
88-
init() {
89-
this._super(...arguments);
90-
componentInstance = this;
91-
},
92-
actions: {
93-
transitionToSister() {
94-
get(this, 'routerService').transitionTo('parent.sister');
95-
},
85+
let FooBar = Component.extend({
86+
routerService: service('router'),
87+
layout: this.compile('foo-bar'),
88+
init() {
89+
this._super(...arguments);
90+
componentInstance = this;
91+
},
92+
actions: {
93+
transitionToSister() {
94+
get(this, 'routerService').transitionTo('parent.sister');
9695
},
97-
}),
98-
template: `foo-bar`,
96+
},
97+
});
98+
99+
this.addComponent('foo-bar', {
100+
ComponentClass: FooBar,
99101
});
100102

101103
this.render('{{foo-bar}}');

tests/index.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
EmberENV['RAISE_ON_DEPRECATION'] = true;
4747

4848
if (QUnit.urlParams.ALL_DEPRECATIONS_ENABLED) {
49-
EmberENV['_ALL_DEPRECATIONS_ENABLED'] = QUnit.urlParams.ALL_DEPRECATIONS_ENABLED;
49+
EmberENV['_ALL_DEPRECATIONS_ENABLED'] = true;
5050
}
5151

5252
if (QUnit.urlParams.OVERRIDE_DEPRECATION_VERSION) {
@@ -109,6 +109,11 @@
109109
label: 'Deprecation Version',
110110
});
111111

112+
QUnit.config.urlConfig.push({
113+
id: 'ALL_DEPRECATIONS_ENABLED',
114+
label: 'Enable All Deprecations',
115+
});
116+
112117

113118
if (QUnit.config.seed) {
114119
QUnit.config.reorder = false;

0 commit comments

Comments
 (0)