-
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-card): migrate stencil e2e tests to spec test (#…
…1261) * migrate e2e tests to spec tests * run formatter * implement pr feedback * fix format * implement PR feedback
- Loading branch information
Showing
8 changed files
with
59 additions
and
51 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
packages/elements/src/components/ino-card/ino-card.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,28 @@ | ||
import { newSpecPage, SpecPage } from '@stencil/core/testing'; | ||
import { Card } from './ino-card'; | ||
import { listenForEvent } from '../../util/test-utils'; | ||
|
||
const INO_CARD = `<ino-card></ino-card>`; | ||
const CARD_SELECTOR = 'ino-card'; | ||
|
||
describe('InoCard', () => { | ||
let page: SpecPage; | ||
let card: HTMLInoCardElement; | ||
|
||
beforeEach(async () => { | ||
page = await newSpecPage({ | ||
components: [Card], | ||
html: INO_CARD, | ||
}); | ||
card = page.body.querySelector(CARD_SELECTOR); | ||
}); | ||
|
||
it('should emit a clickEl event upon interacting with the card', async () => { | ||
const { eventSpy } = listenForEvent(page, 'click'); | ||
|
||
card.click(); | ||
await page.waitForChanges(); | ||
|
||
expect(eventSpy).toHaveBeenCalled(); | ||
}); | ||
}); |
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
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
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,17 @@ | ||
import { expect, Locator, test } from '@playwright/test'; | ||
import { goToStory, setAttribute } from '../test-utils'; | ||
|
||
test.describe('ino-card', () => { | ||
let inoCard: Locator; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await goToStory(page, ['Structure', 'ino-card', 'default']); | ||
inoCard = page.locator('ino-card'); | ||
}); | ||
|
||
test('should render with check mark if selected', async () => { | ||
await setAttribute(inoCard, 'selected', 'true'); | ||
const check_mark = inoCard.locator('.ino-card__checkmark'); | ||
await expect(check_mark).toBeVisible(); | ||
}); | ||
}); |
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
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
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,6 @@ | ||
declare type StoryCategory = | ||
| 'Structure' | ||
| 'Input' | ||
| 'Graphic' | ||
| 'Buttons' | ||
| 'Notification'; |