From bb84d42d677d59ad4e5ad318203f45581f9b062e Mon Sep 17 00:00:00 2001 From: Sander Date: Mon, 22 May 2023 22:18:56 +0200 Subject: [PATCH] feat(ct): svelte partial update (#23193) --- packages/playwright-ct-svelte/index.d.ts | 28 ++++++++------------- packages/playwright-ct-svelte/register.d.ts | 2 +- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/playwright-ct-svelte/index.d.ts b/packages/playwright-ct-svelte/index.d.ts index 65f4cc85fe..19c5a9d1b2 100644 --- a/packages/playwright-ct-svelte/index.d.ts +++ b/packages/playwright-ct-svelte/index.d.ts @@ -36,30 +36,27 @@ export type PlaywrightTestConfig = Omit & { default?: ComponentSlot }; +type ComponentEvents = Record; -export interface MountOptions< - HooksConfig extends JsonObject, - Component extends SvelteComponent -> { +export interface MountOptions { props?: ComponentProps; - slots?: Record & { default?: Slot }; - on?: Record; + slots?: ComponentSlots; + on?: ComponentEvents; hooksConfig?: HooksConfig; } interface MountResult extends Locator { unmount(): Promise; - update( - options: Omit, 'hooksConfig' | 'slots'> - ): Promise; + update(options: { + props?: Partial>; + on?: Partial; + }): Promise; } interface ComponentFixtures { - mount< - HooksConfig extends JsonObject, - Component extends SvelteComponent = SvelteComponent - >( + mount( component: new (...args: any[]) => Component, options?: MountOptions ): Promise>; @@ -70,9 +67,6 @@ export const test: TestType< PlaywrightWorkerArgs & PlaywrightWorkerOptions >; -/** - * Defines Playwright config - */ export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; diff --git a/packages/playwright-ct-svelte/register.d.ts b/packages/playwright-ct-svelte/register.d.ts index 2a6eec42f4..1431000f4b 100644 --- a/packages/playwright-ct-svelte/register.d.ts +++ b/packages/playwright-ct-svelte/register.d.ts @@ -15,7 +15,7 @@ */ export default function( - components: { [key: string]: any }, + components: Record, options?: { window?: Window }