feat(ct): svelte mount type (#17228)
This commit is contained in:
parent
72a18754ef
commit
344077b04e
11
packages/playwright-ct-svelte/index.d.ts
vendored
11
packages/playwright-ct-svelte/index.d.ts
vendored
|
|
@ -24,6 +24,7 @@ import type {
|
||||||
Locator,
|
Locator,
|
||||||
} from '@playwright/test';
|
} from '@playwright/test';
|
||||||
import type { InlineConfig } from 'vite';
|
import type { InlineConfig } from 'vite';
|
||||||
|
import type { SvelteComponent, ComponentProps } from 'svelte/types/runtime'
|
||||||
|
|
||||||
export type PlaywrightTestConfig = Omit<BasePlaywrightTestConfig, 'use'> & {
|
export type PlaywrightTestConfig = Omit<BasePlaywrightTestConfig, 'use'> & {
|
||||||
use?: BasePlaywrightTestConfig['use'] & {
|
use?: BasePlaywrightTestConfig['use'] & {
|
||||||
|
|
@ -36,8 +37,8 @@ export type PlaywrightTestConfig = Omit<BasePlaywrightTestConfig, 'use'> & {
|
||||||
|
|
||||||
type Slot = string | string[];
|
type Slot = string | string[];
|
||||||
|
|
||||||
export interface MountOptions<Props = Record<string, unknown>> {
|
export interface MountOptions<Component extends SvelteComponent> {
|
||||||
props?: Props;
|
props?: ComponentProps<Component>;
|
||||||
slots?: Record<string, Slot> & { default?: Slot };
|
slots?: Record<string, Slot> & { default?: Slot };
|
||||||
on?: Record<string, Function>;
|
on?: Record<string, Function>;
|
||||||
hooksConfig?: any;
|
hooksConfig?: any;
|
||||||
|
|
@ -48,8 +49,10 @@ interface MountResult extends Locator {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ComponentFixtures {
|
interface ComponentFixtures {
|
||||||
mount(component: any, options?: MountOptions): Promise<MountResult>;
|
mount<Component extends SvelteComponent>(
|
||||||
mount<Props>(component: any, options: MountOptions & { props: Props }): Promise<MountResult>;
|
component: new (...args: any[]) => Component,
|
||||||
|
options?: MountOptions<Component>
|
||||||
|
): Promise<MountResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const test: TestType<
|
export const test: TestType<
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
export let title;
|
export let title: string;
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue