Skip to content

Commit

Permalink
test(fw-modal): added test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Asif Ahmed authored and asif-ahmed-1990 committed Aug 28, 2020
1 parent a4bd59c commit c04c210
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/components/modal/modal.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,27 @@ describe('fw-modal', () => {
const element = await page.find('fw-modal');
expect(element).toHaveClass('hydrated');
});

it('triggers fwClose when visible property is changed to false', async () => {
const page = await newE2EPage();

await page.setContent('<fw-modal visible></fw-modal>');
const element = await page.find('fw-modal');
const fwClosed = await page.spyOnEvent('fwClosed');
element.setAttribute('visible', false);
await page.waitForChanges();
expect(fwClosed).toHaveReceivedEvent();
});

it('triggers fwAction when Action Button is clicked', async () => {
const page = await newE2EPage();

await page.setContent('<fw-modal visible></fw-modal>');
await page.waitForChanges();
const element = await page.findAll('fw-modal >>> fw-button');
const fwAction = await page.spyOnEvent('fwAction');
await element[1].click();
await page.waitForChanges();
expect(fwAction).toHaveReceivedEvent();
});
});

0 comments on commit c04c210

Please sign in to comment.