Skip to content

Commit

Permalink
test(toast): add e2e tests for open attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
dgonzalezr committed Jul 3, 2023
1 parent 1812bdb commit 5f9691e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/bee-q/src/components/toast/__tests__/bq-toast.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,42 @@ describe('bq-toast', () => {
expect(element.shadowRoot).not.toBeNull();
});

it('should render as hidden', async () => {
const page = await newE2EPage();
await page.setContent('<bq-toast></bq-toast>');

const element = await page.find('bq-toast');
expect(element).toEqualAttribute('aria-hidden', 'true');
expect(element).toHaveClass('is-hidden');
});

it('should render as hidden with `open="false"`', async () => {
const page = await newE2EPage();
await page.setContent('<bq-toast open="false"></bq-toast>');

const element = await page.find('bq-toast');
expect(element).toEqualAttribute('aria-hidden', 'true');
expect(element).toHaveClass('is-hidden');
});

it('should render as open', async () => {
const page = await newE2EPage();
await page.setContent('<bq-toast open></bq-toast>');

const element = await page.find('bq-toast');
expect(element).not.toEqualAttribute('aria-hidden', 'true');
expect(element).not.toHaveClass('is-hidden');
});

it('should render as open with `open="true"`', async () => {
const page = await newE2EPage();
await page.setContent('<bq-toast open></bq-toast>');

const element = await page.find('bq-toast');
expect(element).not.toEqualAttribute('aria-hidden', 'true');
expect(element).not.toHaveClass('is-hidden');
});

it('should display text', async () => {
const page = await newE2EPage();
await page.setContent('<bq-toast>Text</bq-toast>');
Expand Down

0 comments on commit 5f9691e

Please sign in to comment.