Skip to content

Commit a2d16de

Browse files
committed
[meta] Test $Button()
1 parent db90f22 commit a2d16de

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/windows.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,28 @@ test.describe('$Window Component', () => {
652652
});
653653
});
654654

655+
test.describe('$Button()', () => {
656+
test('should add a button to the window', async ({ page }) => {
657+
const hTestState = await page.evaluateHandle(() => {
658+
const testState = { buttonClicks: 0, buttonText: '' };
659+
const $window = $Window({
660+
title: 'Test Window'
661+
});
662+
const $button = $window.$Button('Click me', () => {
663+
testState.buttonClicks++;
664+
});
665+
testState.buttonText = $button.text();
666+
return testState;
667+
});
668+
await expect(page.getByText('Click me')).toBeVisible();
669+
await page.getByText('Click me').click();
670+
await expect(await hTestState.evaluate((testState) => testState)).toStrictEqual({
671+
buttonClicks: 1,
672+
buttonText: 'Click me',
673+
});
674+
});
675+
});
676+
655677
test.describe("focus management", () => {
656678
// Test cases where it should refocus the last focused control in the window:
657679
// - Click in the blank space of the window

0 commit comments

Comments
 (0)