Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions tests/components/ct-react-vite/src/tests.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Counter from './components/Counter';

test.use({ viewport: { width: 500, height: 500 } });

test('props should work', async ({ mount }) => {
test('render props', async ({ mount }) => {
const component = await mount(<Button title="Submit" />);
await expect(component).toContainText('Submit');
});
Expand Down Expand Up @@ -47,7 +47,7 @@ test('renderer updates slots without remounting', async ({ mount }) => {
await expect(component.locator('#remount-count')).toContainText('1')
})

test('callback should work', async ({ mount }) => {
test('execute callback when the button is clicked', async ({ mount }) => {
const messages: string[] = []
const component = await mount(<Button title="Submit" onClick={data => {
messages.push(data)
Expand All @@ -56,14 +56,14 @@ test('callback should work', async ({ mount }) => {
expect(messages).toEqual(['hello'])
})

test('default slot should work', async ({ mount }) => {
test('render a default child', async ({ mount }) => {
const component = await mount(<DefaultChildren>
Main Content
</DefaultChildren>)
await expect(component).toContainText('Main Content')
})

test('multiple children should work', async ({ mount }) => {
test('render multiple children', async ({ mount }) => {
const component = await mount(<DefaultChildren>
<div id="one">One</div>
<div id="two">Two</div>
Expand All @@ -72,7 +72,7 @@ test('multiple children should work', async ({ mount }) => {
await expect(component.locator('#two')).toContainText('Two')
})

test('named children should work', async ({ mount }) => {
test('render named children', async ({ mount }) => {
const component = await mount(<MultipleChildren>
<div>Header</div>
<div>Main Content</div>
Expand All @@ -83,7 +83,7 @@ test('named children should work', async ({ mount }) => {
await expect(component).toContainText('Footer')
})

test('children should callback', async ({ mount }) => {
test('execute callback when a child node is clicked', async ({ mount }) => {
let clickFired = false;
const component = await mount(<DefaultChildren>
<span onClick={() => clickFired = true}>Main Content</span>
Expand All @@ -92,7 +92,7 @@ test('children should callback', async ({ mount }) => {
expect(clickFired).toBeTruthy();
})

test('should run hooks', async ({ page, mount }) => {
test('run hooks', async ({ page, mount }) => {
const messages: string[] = [];
page.on('console', m => messages.push(m.text()));
await mount(<Button title="Submit" />, {
Expand All @@ -103,14 +103,14 @@ test('should run hooks', async ({ page, mount }) => {
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
});

test('should unmount', async ({ page, mount }) => {
test('unmount', async ({ page, mount }) => {
const component = await mount(<Button title="Submit" />)
await expect(page.locator('#root')).toContainText('Submit')
await component.unmount();
await expect(page.locator('#root')).not.toContainText('Submit');
});

test('unmount a multi root component should work', async ({ mount, page }) => {
test('unmount a multi root component', async ({ mount, page }) => {
const component = await mount(<MultiRoot />)
await expect(page.locator('#root')).toContainText('root 1')
await expect(page.locator('#root')).toContainText('root 2')
Expand Down
20 changes: 10 additions & 10 deletions tests/components/ct-react/src/tests.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Counter from './components/Counter';

test.use({ viewport: { width: 500, height: 500 } });

test('props should work', async ({ mount }) => {
test('render props', async ({ mount }) => {
const component = await mount(<Button title="Submit" />);
await expect(component).toContainText('Submit');
});
Expand Down Expand Up @@ -50,7 +50,7 @@ test('renderer updates slots without remounting', async ({ mount }) => {
await expect(component.locator('#remount-count')).toContainText('1')
});

test('callback should work', async ({ mount }) => {
test('execute callback when the button is clicked', async ({ mount }) => {
const messages: string[] = []
const component = await mount(<Button title="Submit" onClick={data => {
messages.push(data)
Expand All @@ -59,14 +59,14 @@ test('callback should work', async ({ mount }) => {
expect(messages).toEqual(['hello'])
})

test('default slot should work', async ({ mount }) => {
test('render a default child', async ({ mount }) => {
const component = await mount(<DefaultChildren>
Main Content
</DefaultChildren>)
await expect(component).toContainText('Main Content')
})

test('multiple children should work', async ({ mount }) => {
test('render multiple children', async ({ mount }) => {
const component = await mount(<DefaultChildren>
<div id="one">One</div>
<div id="two">Two</div>
Expand All @@ -75,7 +75,7 @@ test('multiple children should work', async ({ mount }) => {
await expect(component.locator('#two')).toContainText('Two')
})

test('named children should work', async ({ mount }) => {
test('render named children', async ({ mount }) => {
const component = await mount(<MultipleChildren>
<div>Header</div>
<div>Main Content</div>
Expand All @@ -86,7 +86,7 @@ test('named children should work', async ({ mount }) => {
await expect(component).toContainText('Footer')
})

test('children should callback', async ({ mount }) => {
test('execute callback when a child node is clicked', async ({ mount }) => {
let clickFired = false;
const component = await mount(<DefaultChildren>
<span onClick={() => clickFired = true}>Main Content</span>
Expand All @@ -95,7 +95,7 @@ test('children should callback', async ({ mount }) => {
expect(clickFired).toBeTruthy();
})

test('should run hooks', async ({ page, mount }) => {
test('run hooks', async ({ page, mount }) => {
const messages: string[] = [];
page.on('console', m => messages.push(m.text()));
await mount(<Button title="Submit" />, {
Expand All @@ -106,14 +106,14 @@ test('should run hooks', async ({ page, mount }) => {
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
});

test('should unmount', async ({ page, mount }) => {
test('unmount', async ({ page, mount }) => {
const component = await mount(<Button title="Submit" />)
await expect(page.locator('#root')).toContainText('Submit')
await component.unmount();
await expect(page.locator('#root')).not.toContainText('Submit');
});

test('unmount a multi root component should work', async ({ mount, page }) => {
test('unmount a multi root component', async ({ mount, page }) => {
const component = await mount(<MultiRoot />)
await expect(page.locator('#root')).toContainText('root 1')
await expect(page.locator('#root')).toContainText('root 2')
Expand All @@ -122,7 +122,7 @@ test('unmount a multi root component should work', async ({ mount, page }) => {
await expect(page.locator('#root')).not.toContainText('root 2')
})

test('toHaveText works on delayed data', async ({ mount }) => {
test('render delayed data', async ({ mount }) => {
const component = await mount(<DelayedData data='complete' />);
await expect(component).toHaveText('complete');
});
Expand Down
10 changes: 5 additions & 5 deletions tests/components/ct-solid/src/tests.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import MultiRoot from './components/MultiRoot';

test.use({ viewport: { width: 500, height: 500 } });

test('props should work', async ({ mount }) => {
test('render props', async ({ mount }) => {
const component = await mount(<Button title="Submit" />);
await expect(component).toContainText('Submit');
});

test('callback should work', async ({ mount }) => {
test('execute callback when the button is clicked', async ({ mount }) => {
const messages: string[] = []
const component = await mount(<Button title="Submit" onClick={data => {
messages.push(data)
Expand All @@ -26,7 +26,7 @@ test('default child should work', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})

test('should run hooks', async ({ page, mount }) => {
test('run hooks', async ({ page, mount }) => {
const messages: string[] = [];
page.on('console', m => messages.push(m.text()));
await mount(<Button title="Submit" />, {
Expand All @@ -37,14 +37,14 @@ test('should run hooks', async ({ page, mount }) => {
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
});

test('should unmount', async ({ page, mount }) => {
test('unmount', async ({ page, mount }) => {
const component = await mount(<Button title="Submit" />)
await expect(page.locator('#root')).toContainText('Submit')
await component.unmount();
await expect(page.locator('#root')).not.toContainText('Submit');
});

test('unmount a multi root component should work', async ({ mount, page }) => {
test('unmount a multi root component', async ({ mount, page }) => {
const component = await mount(<MultiRoot />)
await expect(page.locator('#root')).toContainText('root 1')
await expect(page.locator('#root')).toContainText('root 2')
Expand Down
12 changes: 6 additions & 6 deletions tests/components/ct-svelte-vite/src/tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import MultiRoot from './components/MultiRoot.svelte';

test.use({ viewport: { width: 500, height: 500 } });

test('props should work', async ({ mount }) => {
test('render props', async ({ mount }) => {
const component = await mount(Button, {
props: {
title: 'Submit'
Expand All @@ -30,7 +30,7 @@ test('props should work', async ({ mount }) => {
await expect(component).toContainText('Submit')
})

test('event should work', async ({ mount }) => {
test('emit an submit event when the button is clicked', async ({ mount }) => {
const messages = []
const component = await mount(Button, {
props: {
Expand All @@ -44,7 +44,7 @@ test('event should work', async ({ mount }) => {
expect(messages).toEqual(['hello'])
})

test('default slot should work', async ({ mount }) => {
test('render a default slot', async ({ mount }) => {
const component = await mount(DefaultSlot, {
slots: {
default: 'Main Content'
Expand All @@ -53,7 +53,7 @@ test('default slot should work', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})

test('should run hooks', async ({ page, mount }) => {
test('run hooks', async ({ page, mount }) => {
const messages = []
page.on('console', m => messages.push(m.text()))
await mount(Button, {
Expand All @@ -65,7 +65,7 @@ test('should run hooks', async ({ page, mount }) => {
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
})

test('should unmount', async ({ page, mount }) => {
test('unmount', async ({ page, mount }) => {
const component = await mount(Button, {
props: {
title: 'Submit'
Expand All @@ -76,7 +76,7 @@ test('should unmount', async ({ page, mount }) => {
await expect(page.locator('#root')).not.toContainText('Submit');
});

test('unmount a multi root component should work', async ({ mount, page }) => {
test('unmount a multi root component', async ({ mount, page }) => {
const component = await mount(MultiRoot)
await expect(page.locator('#root')).toContainText('root 1')
await expect(page.locator('#root')).toContainText('root 2')
Expand Down
12 changes: 6 additions & 6 deletions tests/components/ct-svelte/src/tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import MultiRoot from './components/MultiRoot.svelte';

test.use({ viewport: { width: 500, height: 500 } });

test('props should work', async ({ mount }) => {
test('render props', async ({ mount }) => {
const component = await mount(Button, {
props: {
title: 'Submit'
Expand All @@ -30,7 +30,7 @@ test('props should work', async ({ mount }) => {
await expect(component).toContainText('Submit')
})

test('event should work', async ({ mount }) => {
test('emit an submit event when the button is clicked', async ({ mount }) => {
const messages = []
const component = await mount(Button, {
props: {
Expand All @@ -44,7 +44,7 @@ test('event should work', async ({ mount }) => {
expect(messages).toEqual(['hello'])
})

test('default slot should work', async ({ mount }) => {
test('render a default slot', async ({ mount }) => {
const component = await mount(DefaultSlot, {
slots: {
default: 'Main Content'
Expand All @@ -53,7 +53,7 @@ test('default slot should work', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})

test('should run hooks', async ({ page, mount }) => {
test('run hooks', async ({ page, mount }) => {
const messages = []
page.on('console', m => messages.push(m.text()))
await mount(Button, {
Expand All @@ -65,7 +65,7 @@ test('should run hooks', async ({ page, mount }) => {
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
})

test('should unmount', async ({ page, mount }) => {
test('unmount', async ({ page, mount }) => {
const component = await mount(Button, {
props: {
title: 'Submit'
Expand All @@ -76,7 +76,7 @@ test('should unmount', async ({ page, mount }) => {
await expect(page.locator('#root')).not.toContainText('Submit');
});

test('unmount a multi root component should work', async ({ mount, page }) => {
test('unmount a multi root component', async ({ mount, page }) => {
const component = await mount(MultiRoot)
await expect(page.locator('#root')).toContainText('root 1')
await expect(page.locator('#root')).toContainText('root 2')
Expand Down
16 changes: 8 additions & 8 deletions tests/components/ct-vue-cli/src/notation-jsx.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import MultiRoot from './components/MultiRoot.vue'

test.use({ viewport: { width: 500, height: 500 } })

test('props should work', async ({ mount }) => {
test('render props', async ({ mount }) => {
const component = await mount(<Button title="Submit" />)
await expect(component).toContainText('Submit')
})
Expand All @@ -25,7 +25,7 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
await expect(component.locator('#remount-count')).toContainText('1')
})

test('event should work', async ({ mount }) => {
test('emit an submit event when the button is clicked', async ({ mount }) => {
const messages = []
const component = await mount(<Button title='Submit' v-on:submit={data => {
messages.push(data)
Expand All @@ -34,14 +34,14 @@ test('event should work', async ({ mount }) => {
expect(messages).toEqual(['hello'])
})

test('default slot should work', async ({ mount }) => {
test('render a default slot', async ({ mount }) => {
const component = await mount(<DefaultSlot>
Main Content
</DefaultSlot>)
await expect(component).toContainText('Main Content')
})

test('multiple slots should work', async ({ mount }) => {
test('render a component with multiple children', async ({ mount }) => {
const component = await mount(<DefaultSlot>
<div id="one">One</div>
<div id="two">Two</div>
Expand All @@ -50,7 +50,7 @@ test('multiple slots should work', async ({ mount }) => {
await expect(component.locator('#two')).toContainText('Two')
})

test('named slots should work', async ({ mount }) => {
test('render a component with a named slot', async ({ mount }) => {
const component = await mount(<NamedSlots>
<template v-slot:header>
Header
Expand All @@ -67,7 +67,7 @@ test('named slots should work', async ({ mount }) => {
await expect(component).toContainText('Footer')
})

test('slot should emit events', async ({ mount }) => {
test('emit a event when a slot is clicked', async ({ mount }) => {
let clickFired = false;
const component = await mount(<DefaultSlot>
<span v-on:click={() => clickFired = true}>Main Content</span>
Expand All @@ -76,7 +76,7 @@ test('slot should emit events', async ({ mount }) => {
expect(clickFired).toBeTruthy();
})

test('should run hooks', async ({ page, mount }) => {
test('run hooks', async ({ page, mount }) => {
const messages = []
page.on('console', m => messages.push(m.text()))
await mount(<Button title="Submit" />, {
Expand All @@ -85,7 +85,7 @@ test('should run hooks', async ({ page, mount }) => {
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}, app: true', 'After mount el: HTMLButtonElement'])
})

test('unmount a multi root component should work', async ({ mount, page }) => {
test('unmount a multi root component', async ({ mount, page }) => {
const component = await mount(<MultiRoot />)
await expect(page.locator('#root')).toContainText('root 1')
await expect(page.locator('#root')).toContainText('root 2')
Expand Down
Loading