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
11 changes: 7 additions & 4 deletions packages/playwright-ct-svelte/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'] & {
Expand All @@ -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;
Expand All @@ -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<
Expand Down
4 changes: 2 additions & 2 deletions tests/components/ct-svelte-vite/src/components/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
<script lang="ts">
import { createEventDispatcher } from "svelte";
export let title;
export let title: string;
const dispatch = createEventDispatcher();
</script>

Expand Down