-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(elements/ino-snackbar): migrate stencil e2e tests to spec te…
- Loading branch information
Showing
2 changed files
with
30 additions
and
46 deletions.
There are no files selected for viewing
46 changes: 0 additions & 46 deletions
46
packages/elements/src/components/ino-snackbar/ino-snackbar.e2e.ts
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
packages/elements/src/components/ino-snackbar/ino-snackbar.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |