mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
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,
|
||||
} from '@playwright/test';
|
||||
import type { InlineConfig } from 'vite';
|
||||
import type { SvelteComponent, ComponentProps } from 'svelte/types/runtime'
|
||||
|
||||
export type PlaywrightTestConfig = Omit<BasePlaywrightTestConfig, 'use'> & {
|
||||
use?: BasePlaywrightTestConfig['use'] & {
|
||||
@ -36,8 +37,8 @@ export type PlaywrightTestConfig = Omit<BasePlaywrightTestConfig, 'use'> & {
|
||||
|
||||
type Slot = string | string[];
|
||||
|
||||
export interface MountOptions<Props = Record<string, unknown>> {
|
||||
props?: Props;
|
||||
export interface MountOptions<Component extends SvelteComponent> {
|
||||
props?: ComponentProps<Component>;
|
||||
slots?: Record<string, Slot> & { default?: Slot };
|
||||
on?: Record<string, Function>;
|
||||
hooksConfig?: any;
|
||||
@ -48,8 +49,10 @@ interface MountResult extends Locator {
|
||||
}
|
||||
|
||||
interface ComponentFixtures {
|
||||
mount(component: any, options?: MountOptions): Promise<MountResult>;
|
||||
mount<Props>(component: any, options: MountOptions & { props: Props }): Promise<MountResult>;
|
||||
mount<Component extends SvelteComponent>(
|
||||
component: new (...args: any[]) => Component,
|
||||
options?: MountOptions<Component>
|
||||
): Promise<MountResult>;
|
||||
}
|
||||
|
||||
export const test: TestType<
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
export let title;
|
||||
export let title: string;
|
||||
const dispatch = createEventDispatcher();
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user