mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: add a props.children test (#29026)
Closes https://github.com/microsoft/playwright/issues/29023
This commit is contained in:
parent
300a0127de
commit
2328b83af7
@ -495,3 +495,23 @@ test('should normalize children', async ({ runInlineTest }) => {
|
|||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
expect(result.passed).toBe(2);
|
expect(result.passed).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should allow props children', async ({ runInlineTest }) => {
|
||||||
|
const result = await runInlineTest({
|
||||||
|
'playwright.config.ts': playwrightConfig,
|
||||||
|
'playwright/index.html': `<script type="module" src="./index.ts"></script>`,
|
||||||
|
'playwright/index.ts': ``,
|
||||||
|
'src/component.spec.tsx': `
|
||||||
|
import { test, expect } from '@playwright/experimental-ct-react';
|
||||||
|
|
||||||
|
test("renders children from props object", async ({ mount, page }) => {
|
||||||
|
const props = { children: 'test' };
|
||||||
|
await mount(<button {...props} />);
|
||||||
|
await expect(page.getByText('test')).toBeVisible();
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
}, { workers: 1 });
|
||||||
|
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
expect(result.passed).toBe(1);
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user