Skip to content

Commit 54af59f

Browse files
committed
test: update test
1 parent d95dc90 commit 54af59f

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

elements/pf-alert/demo/variations.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import '@patternfly/elements/pf-button/pf-button.js';
3131
</script>
3232

33-
3433
<style>
3534
pf-alert {
3635
margin-block-end: 1em;

elements/pf-alert/test/pf-alert.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,35 @@ describe('pf-alert Unit Tests', () => {
1212
const el = await fixture(html`
1313
<pf-alert><span slot="title">My Title</span></pf-alert>
1414
`);
15-
const titleSlot = el.shadowRoot!.querySelector('#title-area slot[name="title"]');
15+
const titleSlot = el.shadowRoot!.querySelector('#title slot[name="title"]');
1616
expect(titleSlot).to.exist;
1717
});
1818

19-
it('close button should appear when onClose=true', async () => {
20-
const el = await fixture(html`<pf-alert .onClose=${true}></pf-alert>`);
21-
const btn = el.shadowRoot!.querySelector('#close-button')!;
19+
it('close button should appear when dismissable=true', async () => {
20+
const el = await fixture(html`<pf-alert .dismissable=${true}></pf-alert>`);
21+
const btn = el.shadowRoot!.querySelector('#close')!;
2222
expect(btn.hasAttribute('hidden')).to.be.false;
2323
});
2424

2525
it('should remove itself after timeout', async () => {
2626
const el = await fixture(html`<pf-alert .timeout=${50}></pf-alert>`);
27-
const removed = new Promise<void>(resolve => el.addEventListener('pf-alert:timeout', () => resolve()));
27+
const removed = new Promise<void>(resolve => el.addEventListener('close', () => resolve()));
2828
await removed;
2929
expect(document.body.contains(el)).to.be.false;
3030
});
3131

32-
it('should toggle isExpandable when toggle button clicked', async () => {
32+
it('should toggle expanded when toggle button clicked', async () => {
3333
const el = await fixture(html`
34-
<pf-alert isExpandable><span slot="isExpandable">Content</span></pf-alert>
34+
<pf-alert expandable><span>Content</span></pf-alert>
3535
`) as any;
3636
await el.updateComplete;
37-
const toggle = el.shadowRoot!.querySelector('#toggle-button') as HTMLElement;
38-
const initial = el.isExpandable;
37+
const toggle = el.shadowRoot!.querySelector('#toggle') as HTMLElement;
38+
const initial = el.expanded;
3939
toggle.click();
4040
await el.updateComplete;
41-
expect(el.isExpandable).to.equal(!initial);
41+
expect(el.expanded).to.equal(!initial);
4242
toggle.click();
4343
await el.updateComplete;
44-
expect(el.isExpandable).to.equal(initial);
44+
expect(el.expanded).to.equal(initial);
4545
});
4646
});

0 commit comments

Comments
 (0)