Skip to content

Commit

Permalink
refactor(elements/ino-snackbar): migrate stencil e2e tests to spec te…
Browse files Browse the repository at this point in the history
…st (#1355)

Part of #1258

## Proposed Changes

- migrate left stencil e2e test to spec test
  • Loading branch information
BenPag authored Apr 5, 2024
1 parent 1ae1213 commit bbde91d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 46 deletions.
46 changes: 0 additions & 46 deletions packages/elements/src/components/ino-snackbar/ino-snackbar.e2e.ts

This file was deleted.

30 changes: 30 additions & 0 deletions packages/elements/src/components/ino-snackbar/ino-snackbar.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { newSpecPage, SpecPage } from '@stencil/core/testing';
import { Snackbar } from './ino-snackbar';
import { IconButton } from '../ino-icon-button/ino-icon-button';
import { listenForEvent } from '../../util/test-utils';

describe('InoSnackbar', () => {
let page: SpecPage;
let inoSnackbar: HTMLInoSnackbarElement;

beforeEach(async () => {
page = await newSpecPage({
components: [Snackbar, IconButton],
html: `<ino-snackbar></ino-snackbar>`,
});
inoSnackbar = page.body.querySelector('ino-snackbar');
});

it('should emit an actionClick event upon clicking the button', async () => {
const { eventSpy } = listenForEvent(page, 'actionClick');

inoSnackbar.setAttribute('action-text', 'my action');
await page.waitForChanges();
inoSnackbar
.querySelector<HTMLButtonElement>('.ino-snackbar-action-btn')
.click();
await page.waitForChanges();

expect(eventSpy).toHaveBeenCalled();
});
});

0 comments on commit bbde91d

Please sign in to comment.