Skip to content

Commit e2d2bf0

Browse files
committed
Failing test for better debugRenderTree names
1 parent 54835c6 commit e2d2bf0

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

packages/@glimmer-workspace/integration-tests/test/debug-render-tree-test.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,73 @@ class DebugRenderTreeTest extends RenderTest {
110110
]);
111111
}
112112

113+
@test 'strict-mode components without debug symbols preserve names from scope'() {
114+
const state = trackedObj({ showSecond: false });
115+
116+
const HelloWorld = defComponent('{{@arg}}');
117+
const Root = defComponent(
118+
`<HelloWorld @arg="first"/>{{#if state.showSecond}}<HelloWorld @arg="second"/>{{/if}}`,
119+
{ scope: { HelloWorld, state }, emit: { moduleName: 'root.hbs', debugSymbols: false } }
120+
);
121+
122+
this.renderComponent(Root);
123+
124+
this.assertRenderTree([
125+
{
126+
type: 'component',
127+
name: '{ROOT}',
128+
args: { positional: [], named: {} },
129+
instance: null,
130+
template: 'root.hbs',
131+
bounds: this.elementBounds(this.delegate.getInitialElement()),
132+
children: [
133+
{
134+
type: 'component',
135+
name: 'HelloWorld',
136+
args: { positional: [], named: { arg: 'first' } },
137+
instance: null,
138+
template: '(unknown template module)',
139+
bounds: this.nodeBounds(this.delegate.getInitialElement().firstChild),
140+
children: [],
141+
},
142+
],
143+
},
144+
]);
145+
146+
state['showSecond'] = true;
147+
148+
this.assertRenderTree([
149+
{
150+
type: 'component',
151+
name: '{ROOT}',
152+
args: { positional: [], named: {} },
153+
instance: null,
154+
template: 'root.hbs',
155+
bounds: this.elementBounds(this.delegate.getInitialElement()),
156+
children: [
157+
{
158+
type: 'component',
159+
name: 'HelloWorld',
160+
args: { positional: [], named: { arg: 'first' } },
161+
instance: null,
162+
template: '(unknown template module)',
163+
bounds: this.nodeBounds(this.delegate.getInitialElement().firstChild),
164+
children: [],
165+
},
166+
{
167+
type: 'component',
168+
name: 'HelloWorld',
169+
args: { positional: [], named: { arg: 'second' } },
170+
instance: null,
171+
template: '(unknown template module)',
172+
bounds: this.nodeBounds(this.delegate.getInitialElement().lastChild),
173+
children: [],
174+
},
175+
],
176+
},
177+
]);
178+
}
179+
113180
@test 'strict-mode modifiers'() {
114181
const state = trackedObj({ showSecond: false });
115182

0 commit comments

Comments
 (0)