-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 7077-clean-console
- Loading branch information
Showing
111 changed files
with
1,918 additions
and
709 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/dist/ | ||
/dist-e2e/ | ||
/doc/** | ||
/loader/ | ||
/public/ | ||
|
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
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,37 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@stencil/playwright'; | ||
import { KolEvent } from '../../utils/events'; | ||
|
||
test.describe('kol-alert', () => { | ||
test.describe('Callbacks', () => { | ||
test('should call "onClose" callback when the close button is clicked', async ({ page }) => { | ||
await page.setContent('<kol-alert _label="Alert" _has-closer />'); | ||
const callbackPromise = page.locator('kol-alert').evaluate(async (element: HTMLKolAlertElement) => { | ||
return new Promise((resolve) => { | ||
element._on = { | ||
onClose: (_event: Event, value?: unknown) => { | ||
resolve(value); | ||
}, | ||
}; | ||
}); | ||
}); | ||
await page.waitForChanges(); | ||
await page.getByTestId('alert-close-button').click(); | ||
await expect(callbackPromise).resolves.toBeUndefined(); | ||
}); | ||
}); | ||
|
||
test.describe('DOM events', () => { | ||
test('should emit "close" when close button is clicked', async ({ page }) => { | ||
await page.setContent('<kol-alert _label="Alert" _has-closer />'); | ||
const eventPromise = page.locator('kol-alert').evaluate(async (element: HTMLKolAlertElement, KolEvent) => { | ||
return new Promise((resolve) => { | ||
element.addEventListener(KolEvent.close, resolve); | ||
}); | ||
}, KolEvent); | ||
await page.waitForChanges(); | ||
await page.getByTestId('alert-close-button').click(); | ||
await expect(eventPromise).resolves.toBeTruthy(); | ||
}); | ||
}); | ||
}); |
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,48 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@stencil/playwright'; | ||
import { KolEvent } from '../../utils/events'; | ||
|
||
test.describe('kol-badge', () => { | ||
test.describe('Callbacks', () => { | ||
['onClick', 'onMouseDown'].forEach((callbackName) => { | ||
test(`should call ${callbackName} callback when smart button emits`, async ({ page }) => { | ||
await page.setContent(`<kol-badge _label="Badge with Button"></kol-badge>`); | ||
const kolBadge = page.locator('kol-badge'); | ||
|
||
const callbackPromise = kolBadge.evaluate((element: HTMLKolBadgeElement, callbackName) => { | ||
return new Promise<void>((resolve) => { | ||
element._smartButton = { | ||
_label: `Smart Button`, | ||
_on: { | ||
[callbackName]: () => { | ||
resolve(); | ||
}, | ||
}, | ||
}; | ||
}); | ||
}, callbackName); | ||
await page.waitForChanges(); | ||
|
||
await page.locator('button').click(); | ||
await expect(callbackPromise).resolves.toBeUndefined(); | ||
}); | ||
}); | ||
}); | ||
|
||
test.describe('DOM events', () => { | ||
[KolEvent.click, KolEvent.mousedown].forEach((event) => { | ||
test(`should emit ${event} when smart button emits ${event}`, async ({ page }) => { | ||
const BADGE_PROPS = { _label: `Smart Button` }; | ||
await page.setContent(`<kol-badge _label="Badge with Button" _smart-button='${JSON.stringify(BADGE_PROPS)}'></kol-badge>`); | ||
const eventPromise = page.locator('kol-badge').evaluate(async (element, event) => { | ||
return new Promise((resolve) => { | ||
element.addEventListener(event, resolve); | ||
}); | ||
}, event); | ||
await page.waitForChanges(); | ||
await page.locator('button').dispatchEvent(event); | ||
await expect(eventPromise).resolves.toBeTruthy(); | ||
}); | ||
}); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
packages/components/src/components/button-link/button-link.e2e.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,50 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@stencil/playwright'; | ||
import { KolEvent } from '../../utils/events'; | ||
|
||
test.describe('kol-button-link', () => { | ||
test('it renders label', async ({ page }) => { | ||
await page.setContent('<kol-button-link _label="Test ButtonLink Element" _variant="primary"></kol-button-link>'); | ||
const kolButton = page.locator('kol-button-link'); | ||
await expect(kolButton).toContainText('Test ButtonLink Element'); | ||
}); | ||
|
||
test.describe('Callbacks', () => { | ||
['onClick', 'onMouseDown'].forEach((callbackName) => { | ||
test(`should call ${callbackName} callback when internal button emits`, async ({ page }) => { | ||
await page.setContent('<kol-button-link _label="Button"></kol-button-link>'); | ||
const kolButton = page.locator('kol-button-link'); | ||
|
||
const callbackPromise = kolButton.evaluate((element: HTMLKolButtonElement, callbackName) => { | ||
return new Promise<void>((resolve) => { | ||
element._on = { | ||
[callbackName]: () => { | ||
resolve(); | ||
}, | ||
}; | ||
}); | ||
}, callbackName); | ||
await page.waitForChanges(); | ||
|
||
await page.locator('button').click(); | ||
await expect(callbackPromise).resolves.toBeUndefined(); | ||
}); | ||
}); | ||
}); | ||
|
||
test.describe('DOM events', () => { | ||
[KolEvent.click, KolEvent.mousedown].forEach((event) => { | ||
test(`should emit ${event} when internal button emits ${event}`, async ({ page }) => { | ||
await page.setContent('<kol-button-link _label="Button"></kol-button-link>'); | ||
const eventPromise = page.locator('kol-button-link').evaluate(async (element, event) => { | ||
return new Promise((resolve) => { | ||
element.addEventListener(event, resolve); | ||
}); | ||
}, event); | ||
await page.waitForChanges(); | ||
await page.locator('button').dispatchEvent(event); | ||
await expect(eventPromise).resolves.toBeTruthy(); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.