Skip to content

Commit

Permalink
[meta] Test $Button()
Browse files Browse the repository at this point in the history
  • Loading branch information
1j01 committed Jun 20, 2024
1 parent db90f22 commit a2d16de
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/windows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,28 @@ test.describe('$Window Component', () => {
});
});

test.describe('$Button()', () => {
test('should add a button to the window', async ({ page }) => {
const hTestState = await page.evaluateHandle(() => {
const testState = { buttonClicks: 0, buttonText: '' };
const $window = $Window({
title: 'Test Window'
});
const $button = $window.$Button('Click me', () => {
testState.buttonClicks++;
});
testState.buttonText = $button.text();
return testState;
});
await expect(page.getByText('Click me')).toBeVisible();
await page.getByText('Click me').click();
await expect(await hTestState.evaluate((testState) => testState)).toStrictEqual({
buttonClicks: 1,
buttonText: 'Click me',
});
});
});

test.describe("focus management", () => {
// Test cases where it should refocus the last focused control in the window:
// - Click in the blank space of the window
Expand Down

0 comments on commit a2d16de

Please sign in to comment.