Skip to content

Commit 2373413

Browse files
committed
test(back-to-top): fix tests
1 parent 8863b13 commit 2373413

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

elements/pf-back-to-top/test/pf-back-to-top.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ describe('<pf-back-to-top>', function() {
159159
</div>
160160
`);
161161
element = container.querySelector('pf-back-to-top')!;
162-
snapshot = await a11ySnapshot();
163-
164162
await allUpdates(element);
163+
164+
snapshot = await a11ySnapshot({ selector: 'pf-back-to-top' });
165165
});
166166

167167
it('should be hidden on init', function() {
@@ -173,13 +173,14 @@ describe('<pf-back-to-top>', function() {
173173
beforeEach(async function() {
174174
const scrollableElement = document.querySelector('#top')!;
175175
scrollableElement.scrollTo({ top: 401, behavior: 'instant' });
176+
scrollableElement.dispatchEvent(new Event('scroll'));
176177
await nextFrame();
177178
await allUpdates(element);
178179
snapshot = await a11ySnapshot();
179180
});
180181

181182
it('should be visible', function() {
182-
expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
183+
expect(snapshot.children?.at(0)?.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
183184
});
184185
});
185186
});

0 commit comments

Comments
 (0)