mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-10 12:10:17 +00:00
chore: remove Vue and Svelte examples from component testing documentation
This commit is contained in:
parent
d52225c18d
commit
822ffb2429
3 changed files with 1 additions and 65 deletions
|
|
@ -224,8 +224,6 @@ What are you doing?
|
|||
│
|
||||
├─ Framework-specific testing?
|
||||
│ ├─ React app → frameworks/react.md
|
||||
│ ├─ Angular app → frameworks/angular.md
|
||||
│ ├─ Vue/Nuxt app → frameworks/vue.md
|
||||
│ └─ Next.js app → frameworks/nextjs.md
|
||||
│
|
||||
├─ Authentication testing?
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ Test individual components in isolation using Playwright Component Testing.
|
|||
npm init playwright@latest -- --ct
|
||||
```
|
||||
|
||||
For comprehensive component testing patterns including mounting, props, events, slots, mocking, and framework-specific examples (React, Vue, Svelte), see **[component-testing.md](../testing-patterns/component-testing.md)**.
|
||||
For comprehensive component testing patterns including mounting, props, events, slots, mocking, and framework-specific examples, see **[component-testing.md](../testing-patterns/component-testing.md)**.
|
||||
|
||||
## API Tests
|
||||
|
||||
|
|
|
|||
|
|
@ -17,15 +17,6 @@
|
|||
```bash
|
||||
# React
|
||||
npm init playwright@latest -- --ct
|
||||
|
||||
# Vue
|
||||
npm init playwright@latest -- --ct
|
||||
|
||||
# Svelte
|
||||
npm init playwright@latest -- --ct
|
||||
|
||||
# Solid
|
||||
npm init playwright@latest -- --ct
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
|
@ -317,24 +308,6 @@ test("renders children", async ({ mount }) => {
|
|||
});
|
||||
```
|
||||
|
||||
### Testing Named Slots (Vue)
|
||||
|
||||
```tsx
|
||||
// Vue component with slots
|
||||
test("renders named slots", async ({ mount }) => {
|
||||
const component = await mount(Modal, {
|
||||
slots: {
|
||||
header: "<h2>Modal Title</h2>",
|
||||
default: "<p>Modal content</p>",
|
||||
footer: "<button>Close</button>",
|
||||
},
|
||||
});
|
||||
|
||||
await expect(component.getByRole("heading")).toHaveText("Modal Title");
|
||||
await expect(component.getByRole("button")).toHaveText("Close");
|
||||
});
|
||||
```
|
||||
|
||||
### Testing Render Props
|
||||
|
||||
```tsx
|
||||
|
|
@ -449,41 +422,6 @@ test("uses context", async ({ mount }) => {
|
|||
});
|
||||
```
|
||||
|
||||
### Vue Testing
|
||||
|
||||
```tsx
|
||||
import { test, expect } from "@playwright/experimental-ct-vue";
|
||||
import MyInput from "@/components/MyInput.vue";
|
||||
|
||||
// With v-model
|
||||
test("v-model binding", async ({ mount }) => {
|
||||
let modelValue = "";
|
||||
const component = await mount(MyInput, {
|
||||
props: {
|
||||
modelValue,
|
||||
"onUpdate:modelValue": (v: string) => (modelValue = v),
|
||||
},
|
||||
});
|
||||
|
||||
await component.locator("input").fill("test");
|
||||
expect(modelValue).toBe("test");
|
||||
});
|
||||
```
|
||||
|
||||
### Svelte Testing
|
||||
|
||||
```tsx
|
||||
import { test, expect } from "@playwright/experimental-ct-svelte";
|
||||
import Counter from "./Counter.svelte";
|
||||
|
||||
test("Svelte component", async ({ mount }) => {
|
||||
const component = await mount(Counter, { props: { initialCount: 5 } });
|
||||
await expect(component.getByTestId("count")).toHaveText("5");
|
||||
await component.getByRole("button", { name: "+" }).click();
|
||||
await expect(component.getByTestId("count")).toHaveText("6");
|
||||
});
|
||||
```
|
||||
|
||||
## Anti-Patterns to Avoid
|
||||
|
||||
| Anti-Pattern | Problem | Solution |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue