Skip to content

Commit bb84789

Browse files
committed
Removed tests targeting DEPRECATE_COMPONENT_TEMPLATE_RESOLVING
1 parent c1c8b00 commit bb84789

File tree

4 files changed

+7
-242
lines changed

4 files changed

+7
-242
lines changed

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

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,9 @@ class AbstractAppendTest extends RenderingTestCase {
286286
);
287287
}
288288

289-
[`${testUnless(
290-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
291-
)} lifecycle hooks during component append`](assert) {
289+
[`@test lifecycle hooks during component append`](assert) {
292290
let hooks = [];
293291

294-
expectDeprecation(
295-
/resolved templates/,
296-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
297-
);
298-
299292
let oldRegisterComponent = this.registerComponent;
300293
let componentsByName = {};
301294

@@ -539,16 +532,9 @@ class AbstractAppendTest extends RenderingTestCase {
539532
);
540533
}
541534

542-
[`${testUnless(
543-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
544-
)} appending, updating and destroying a single component`](assert) {
535+
[`@test appending, updating and destroying a single component`](assert) {
545536
let willDestroyCalled = 0;
546537

547-
expectDeprecation(
548-
/separately resolved templates/,
549-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
550-
);
551-
552538
this.registerComponent('x-parent', {
553539
ComponentClass: Component.extend({
554540
layoutName: 'components/x-parent',
@@ -566,7 +552,7 @@ class AbstractAppendTest extends RenderingTestCase {
566552
tagName: '',
567553
}),
568554

569-
resolveableTemplate: '[child: {{this.bar}}]{{yield}}',
555+
template: '[child: {{this.bar}}]{{yield}}',
570556
});
571557

572558
let XParent;
@@ -652,9 +638,7 @@ class AbstractAppendTest extends RenderingTestCase {
652638
assert.equal(renderer._roots.length, 0, 'released the root component');
653639
}
654640

655-
[`${testUnless(
656-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
657-
)} appending, updating and destroying multiple components`](assert) {
641+
[`@test appending, updating and destroying multiple components`](assert) {
658642
let willDestroyCalled = 0;
659643

660644
this.registerComponent('x-first', {

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

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { DEBUG } from '@glimmer/env';
2-
import { moduleFor, RenderingTestCase, runTask, testUnless } from 'internal-test-helpers';
2+
import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers';
33

44
import { setComponentTemplate, getComponentTemplate } from '@glimmer/manager';
55
import { Component, compile } from '../../utils/helpers';
6-
import { DEPRECATIONS } from '../../../../deprecations';
76

87
moduleFor(
98
'Components test: setComponentTemplate',
@@ -22,23 +21,6 @@ moduleFor(
2221
this.assertComponentElement(this.firstChild, { content: 'hello' });
2322
}
2423

25-
[`${testUnless(
26-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
27-
)} it takes precedence over resolver`]() {
28-
this.registerComponent('foo-bar', {
29-
ComponentClass: setComponentTemplate(compile('hello'), Component.extend()),
30-
resolveableTemplate: 'noooooo!',
31-
});
32-
33-
this.render('<FooBar />');
34-
35-
this.assertComponentElement(this.firstChild, { content: 'hello' });
36-
37-
runTask(() => this.rerender());
38-
39-
this.assertComponentElement(this.firstChild, { content: 'hello' });
40-
}
41-
4224
'@test calling it with primitives asserts'(assert) {
4325
if (!DEBUG) {
4426
assert.expect(0);

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

Lines changed: 1 addition & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
import { ENV } from '@ember/-internals/environment';
2-
import {
3-
RenderingTestCase,
4-
moduleFor,
5-
runDestroy,
6-
runAppend,
7-
runTask,
8-
testUnless,
9-
expectDeprecation,
10-
} from 'internal-test-helpers';
2+
import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers';
113

124
import { set } from '@ember/object';
135
import { templateCacheCounters } from '@ember/-internals/glimmer';
146
import { Component } from '../utils/helpers';
15-
import { DEPRECATIONS } from '../../../deprecations';
167

178
moduleFor(
189
'ember-glimmer runtime resolver cache',
@@ -125,116 +116,6 @@ moduleFor(
125116
this.expectCacheChanges({}, 'toggle back to component-two no change');
126117
}
127118

128-
[`${testUnless(
129-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
130-
)} each template is only compiled once`]() {
131-
expectDeprecation(
132-
/resolved templates/,
133-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
134-
);
135-
// static layout
136-
this.registerComponent('component-one', { resolveableTemplate: 'One' });
137-
138-
// test directly import template factory onto late bound layout
139-
let Two = Component.extend({
140-
layout: this.compile('Two'),
141-
});
142-
this.registerComponent('component-two', { ComponentClass: Two });
143-
144-
// inject layout onto component, share layout with component-one
145-
let Root = Component.extend({
146-
layout: this.owner.lookup('template:components/component-one'),
147-
});
148-
149-
this.registerComponent('root-component', { ComponentClass: Root });
150-
151-
// template instance shared between to template managers
152-
let rootFactory = this.owner.factoryFor('component:root-component');
153-
154-
// snapshot counters
155-
this.getCacheCounters();
156-
157-
// show component-one for the first time
158-
this.render(
159-
`
160-
{{~#if this.cond~}}
161-
{{component-one}}
162-
{{~else~}}
163-
{{component-two}}
164-
{{~/if}}`,
165-
{
166-
cond: true,
167-
}
168-
);
169-
170-
this.assertText('One');
171-
this.expectCacheChanges(
172-
{
173-
componentDefinitionCount: 1,
174-
templateCacheMisses: 2,
175-
templateCacheHits: ENV._DEBUG_RENDER_TREE ? 1 : 0,
176-
},
177-
'test case component and component-one no change'
178-
);
179-
180-
// show component-two for the first time
181-
runTask(() => set(this.context, 'cond', false));
182-
183-
this.assertText('Two');
184-
this.expectCacheChanges(
185-
{
186-
templateCacheMisses: 1,
187-
componentDefinitionCount: 1,
188-
templateCacheHits: ENV._DEBUG_RENDER_TREE ? 1 : 0,
189-
},
190-
'component-two first render misses template cache'
191-
);
192-
193-
// show component-one again
194-
runTask(() => set(this.context, 'cond', true));
195-
196-
this.assertText('One');
197-
this.expectCacheChanges({}, 'toggle back to component-one no change');
198-
199-
// show component-two again
200-
runTask(() => set(this.context, 'cond', false));
201-
202-
this.assertText('Two');
203-
this.expectCacheChanges(
204-
{
205-
templateCacheHits: ENV._DEBUG_RENDER_TREE ? 2 : 1,
206-
},
207-
'toggle back to component-two hits template cache'
208-
);
209-
210-
// render new root append
211-
let root = rootFactory.create();
212-
try {
213-
runAppend(root);
214-
this.assertText('TwoOne');
215-
// roots have different capabilities so this will hit
216-
this.expectCacheChanges(
217-
{ templateCacheHits: ENV._DEBUG_RENDER_TREE ? 2 : 1 },
218-
'append root with component-one no change'
219-
);
220-
221-
// render new root append
222-
let root2 = rootFactory.create();
223-
try {
224-
runAppend(root2);
225-
this.assertText('TwoOneOne');
226-
this.expectCacheChanges(
227-
{ templateCacheHits: ENV._DEBUG_RENDER_TREE ? 2 : 1 },
228-
'append another root no change'
229-
);
230-
} finally {
231-
runDestroy(root2);
232-
}
233-
} finally {
234-
runDestroy(root);
235-
}
236-
}
237-
238119
getCacheCounters() {
239120
let { componentDefinitionCount, helperDefinitionCount } = this.renderer._context.constants;
240121

packages/ember/tests/component_registration_test.js

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,8 @@ 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 {
6-
moduleFor,
7-
testUnless,
8-
ApplicationTestCase,
9-
defineComponent,
10-
expectDeprecation,
11-
} from 'internal-test-helpers';
5+
import { moduleFor, ApplicationTestCase, defineComponent } from 'internal-test-helpers';
126
import { DEBUG } from '@glimmer/env';
13-
import { DEPRECATIONS } from '@ember/-internals/deprecations';
147
import templateOnly from '@ember/component/template-only';
158

169
moduleFor(
@@ -84,81 +77,6 @@ moduleFor(
8477
});
8578
}
8679

87-
[`${testUnless(
88-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
89-
)} Late-registered components can be rendered with template registered on the container`](
90-
assert
91-
) {
92-
expectDeprecation(
93-
/resolved templates/,
94-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
95-
);
96-
this.addTemplate(
97-
'application',
98-
`<div id='wrapper'>hello world {{sally-rutherford}}-{{#sally-rutherford}}!!!{{/sally-rutherford}}</div>`
99-
);
100-
101-
this.application.instanceInitializer({
102-
name: 'sally-rutherford-component-template',
103-
initialize(applicationInstance) {
104-
applicationInstance.register(
105-
'template:components/sally-rutherford',
106-
compile('funkytowny{{yield}}')
107-
);
108-
},
109-
});
110-
this.application.instanceInitializer({
111-
name: 'sally-rutherford-component',
112-
initialize(applicationInstance) {
113-
applicationInstance.register('component:sally-rutherford', Component);
114-
},
115-
});
116-
117-
return this.visit('/').then(() => {
118-
let text = this.$('#wrapper').text().trim();
119-
assert.equal(
120-
text,
121-
'hello world funkytowny-funkytowny!!!',
122-
'The component is composed correctly'
123-
);
124-
});
125-
}
126-
127-
[`${testUnless(
128-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
129-
)} Late-registered components can be rendered with ONLY the template registered on the container`](
130-
assert
131-
) {
132-
expectDeprecation(
133-
/resolved templates/,
134-
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled
135-
);
136-
137-
this.addTemplate(
138-
'application',
139-
`<div id='wrapper'>hello world {{borf-snorlax}}-{{#borf-snorlax}}!!!{{/borf-snorlax}}</div>`
140-
);
141-
142-
this.application.instanceInitializer({
143-
name: 'borf-snorlax-component-template',
144-
initialize(applicationInstance) {
145-
applicationInstance.register(
146-
'template:components/borf-snorlax',
147-
compile('goodfreakingTIMES{{yield}}')
148-
);
149-
},
150-
});
151-
152-
return this.visit('/').then(() => {
153-
let text = this.$('#wrapper').text().trim();
154-
assert.equal(
155-
text,
156-
'hello world goodfreakingTIMES-goodfreakingTIMES!!!',
157-
'The component is composed correctly'
158-
);
159-
});
160-
}
161-
16280
['@test Assigning layoutName to a component should setup the template as a layout'](assert) {
16381
assert.expect(1);
16482

0 commit comments

Comments
 (0)