diff --git a/ct-web/src/components/Counter.ts b/ct-web/src/components/Counter.ts index 3f2c7cd..422d128 100644 --- a/ct-web/src/components/Counter.ts +++ b/ct-web/src/components/Counter.ts @@ -1,7 +1,7 @@ let remountCount = 0 export class Counter extends HTMLElement { - set count(count: string) { + set count(count: number) { this.innerHTML = `
${count}
diff --git a/playwright-ct-web/index.d.ts b/playwright-ct-web/index.d.ts index 1fef49d..eb13c51 100644 --- a/playwright-ct-web/index.d.ts +++ b/playwright-ct-web/index.d.ts @@ -39,26 +39,28 @@ type JsonValue = JsonPrimitive | JsonObject | JsonArray; type JsonArray = JsonValue[]; type JsonObject = { [Key in string]?: JsonValue }; +// TODO: get props, probably by filter readonly and function types? +type ComponentProps = Partial; + type Slot = string | string[]; -export interface MountOptions { - props?: Props; +export interface MountOptions { + props?: ComponentProps; slots?: Record & { default?: Slot }; on?: Record; hooksConfig?: HooksConfig; } -interface MountResult< - Props extends Record -> extends Locator { +interface MountResult extends Locator { unmount(): Promise; - update(options: Omit, 'hooksConfig'>): Promise; + update(options: Omit, 'hooksConfig'>): Promise; } export interface ComponentFixtures { - mount( - component: new (...args: any[]) => HTMLElement, options?: MountOptions - ): Promise>; + mount( + component: new (...args: any[]) => Component, + options?: MountOptions + ): Promise>; } export const test: TestType< diff --git a/playwright-ct-web/package.json b/playwright-ct-web/package.json index 58f4cb6..7854ca5 100644 --- a/playwright-ct-web/package.json +++ b/playwright-ct-web/package.json @@ -1,6 +1,6 @@ { "name": "@sand4rt/experimental-ct-web", - "version": "0.0.8", + "version": "0.0.9", "description": "Playwright Component Testing for Web Components", "homepage": "https://playwright.dev", "engines": {