feat(ct): svelte mount type (#17228)

This commit is contained in:
sand4rt 2022-09-12 18:30:04 +02:00 committed by GitHub
parent 72a18754ef
commit 344077b04e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -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<

View File

@ -1,6 +1,6 @@
<script>
<script lang="ts">
import { createEventDispatcher } from "svelte";
export let title;
export let title: string;
const dispatch = createEventDispatcher();
</script>