feat(ct): svelte partial update (#23193)

This commit is contained in:
Sander 2023-05-22 22:18:56 +02:00 committed by GitHub
parent 144f8b1495
commit bb84d42d67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 18 deletions

View File

@ -36,30 +36,27 @@ export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig
}; };
}; };
type Slot = string | string[]; type ComponentSlot = string | string[];
type ComponentSlots = Record<string, ComponentSlot> & { default?: ComponentSlot };
type ComponentEvents = Record<string, Function>;
export interface MountOptions< export interface MountOptions<HooksConfig extends JsonObject, Component extends SvelteComponent> {
HooksConfig extends JsonObject,
Component extends SvelteComponent
> {
props?: ComponentProps<Component>; props?: ComponentProps<Component>;
slots?: Record<string, Slot> & { default?: Slot }; slots?: ComponentSlots;
on?: Record<string, Function>; on?: ComponentEvents;
hooksConfig?: HooksConfig; hooksConfig?: HooksConfig;
} }
interface MountResult<Component extends SvelteComponent> extends Locator { interface MountResult<Component extends SvelteComponent> extends Locator {
unmount(): Promise<void>; unmount(): Promise<void>;
update( update(options: {
options: Omit<MountOptions<never, Component>, 'hooksConfig' | 'slots'> props?: Partial<ComponentProps<Component>>;
): Promise<void>; on?: Partial<ComponentEvents>;
}): Promise<void>;
} }
interface ComponentFixtures { interface ComponentFixtures {
mount< mount<HooksConfig extends JsonObject, Component extends SvelteComponent = SvelteComponent>(
HooksConfig extends JsonObject,
Component extends SvelteComponent = SvelteComponent
>(
component: new (...args: any[]) => Component, component: new (...args: any[]) => Component,
options?: MountOptions<HooksConfig, Component> options?: MountOptions<HooksConfig, Component>
): Promise<MountResult<Component>>; ): Promise<MountResult<Component>>;
@ -70,9 +67,6 @@ export const test: TestType<
PlaywrightWorkerArgs & PlaywrightWorkerOptions PlaywrightWorkerArgs & PlaywrightWorkerOptions
>; >;
/**
* Defines Playwright config
*/
export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig;
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>; export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>; export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;

View File

@ -15,7 +15,7 @@
*/ */
export default function( export default function(
components: { [key: string]: any }, components: Record<string, any>,
options?: { options?: {
window?: Window window?: Window
} }