Skip to content

Commit 8eb9b7d

Browse files
Fix test: use per-test assert parameter and reactive step helper to fix verifySteps failures
Agent-Logs-Url: https://github.com/emberjs/ember.js/sessions/8126c5ce-0399-4465-98ee-8b9eaf691b8c Co-authored-by: NullVoxPopuli <[email protected]>
1 parent 3e1e1c1 commit 8eb9b7d

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

packages/@glimmer-workspace/integration-tests/lib/suites/in-element-document-fragment.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,19 @@ export class InElementDocumentFragmentSuite extends RenderTest {
133133
}
134134

135135
@test
136-
'After fragment is attached to DOM, text updates and new conditional elements appear in the container'() {
136+
'After fragment is attached to DOM, text updates and new conditional elements appear in the container'(
137+
assert: typeof QUnit.assert
138+
) {
137139
const fragment = document.createDocumentFragment();
138140
const container = document.createElement('div');
139-
const step = (text: string) => this.assert.step(text);
141+
const step = (text: string) => {
142+
assert.step(text);
143+
return text;
144+
};
140145

141146
this.render(
142147
'{{#in-element this.fragment}}' +
143-
'<p id="msg">{{this.message}} {{this.step "message rendered"}}</p>' +
148+
'<p id="msg">{{this.step this.message}}</p>' +
144149
'{{#if this.show}}' +
145150
'<span id="extra">extra {{this.step "extra rendered"}}</span>' +
146151
'{{/if}}' +
@@ -153,26 +158,25 @@ export class InElementDocumentFragmentSuite extends RenderTest {
153158
}
154159
);
155160

156-
this.assert.verifySteps(['message rendered'], 'initial render fires step from inside fragment');
161+
assert.verifySteps(['initial'], 'initial render fires step from inside fragment');
157162

158163
// Move fragment's children (including Glimmer's comment bounds) into the container
159164
container.appendChild(fragment);
160-
this.assert.strictEqual(fragment.childNodes.length, 0, 'fragment is empty after append');
161165

162166
// Text-node update: Glimmer holds a direct reference to the text node, so the
163167
// update is visible in the container even though the fragment is now empty.
164168
this.rerender({ message: 'updated' });
165-
this.assert.verifySteps(
166-
['message rendered'],
169+
assert.verifySteps(
170+
['updated'],
167171
'text update fires step even after fragment was attached to the DOM'
168172
);
169173

170174
// New-element update: Glimmer inserts the span relative to the comment bounds,
171175
// which also moved to the container, so the new element appears in the container.
172176
this.rerender({ show: true });
173-
this.assert.verifySteps(
174-
['message rendered', 'extra rendered'],
175-
'new conditional element fires step in the container after fragment was attached to the DOM'
177+
assert.verifySteps(
178+
['extra rendered'],
179+
'conditional element step fires in the container after fragment was attached to the DOM'
176180
);
177181
}
178182

0 commit comments

Comments
 (0)