Skip to content

Commit 0dd2627

Browse files
committed
From review
1 parent 0773805 commit 0dd2627

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

components/expand-collapse/test/expand-collapse-content.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineCE, expect, fixture, html, nextFrame, oneEvent, runConstructor } from '@brightspace-ui/testing';
1+
import { defineCE, expect, fixture, html, oneEvent, runConstructor, waitUntil } from '@brightspace-ui/testing';
22
import { LitElement, nothing } from 'lit';
33
import { states } from '../expand-collapse-content.js';
44

@@ -63,7 +63,7 @@ describe('d2l-expand-collapse-content', () => {
6363
describe('events', () => {
6464

6565
[true, false].forEach(expand => {
66-
const event = `d2l-expand-collapse-content-${expand ? 'expand' : 'collapse'}`;
66+
const event = expand ? 'd2l-expand-collapse-content-expand' : 'd2l-expand-collapse-content-collapse';
6767

6868
async function changeState(content) {
6969
setTimeout(() => content.expanded = expand);
@@ -87,14 +87,14 @@ describe('d2l-expand-collapse-content', () => {
8787
it(`should fire ${event} event with transition states`, async() => {
8888
const content = (await fixture(`<${tagName}${expand ? '' : ' expanded'} transitions></${tagName}>`)).shadowRoot.querySelector('d2l-expand-collapse-content');
8989

90+
9091
const e = await changeState(content);
92+
9193
expect(content._state).to.equal(expand ? states.PREEXPANDING : states.PRECOLLAPSING);
9294

93-
await content.updateComplete;
94-
await nextFrame();
95-
await nextFrame();
95+
const transitionState = (expand ? states.EXPANDING : states.COLLAPSING);
96+
await waitUntil(() => content._state === transitionState, `never reached state: ${transitionState}`);;
9697

97-
expect(content._state).to.equal(expand ? states.EXPANDING : states.COLLAPSING);
9898
await e.detail[`${expand ? 'expand' : 'collapse'}Complete`];
9999
expect(content._state).to.equal(expand ? states.EXPANDED : states.COLLAPSED);
100100
});

0 commit comments

Comments
 (0)