Skip to main content
Glama
deleonio
by deleonio
input-value-reflection.ts1.19 kB
import { expect } from '@playwright/test'; import { test } from '@stencil/playwright'; import type { FillAction } from './utils/FillAction'; import { INPUTS_SELECTOR } from './utils/inputsSelector'; type TestInputValueReflectionOptions = { additionalProperties?: string; componentName: string; equalityCheck?: 'toBe' | 'toEqual'; fillAction?: FillAction; testValue?: unknown; }; const testInputValueReflection = <ElementType extends { _value?: unknown } & (HTMLElement | SVGElement)>({ additionalProperties = '', componentName, equalityCheck = 'toBe', fillAction, testValue, }: TestInputValueReflectionOptions) => { test(`should reflect the _value property on the web component`, async ({ page }) => { await page.setContent(`<${componentName} _label="Input" ${additionalProperties}></${componentName}>`); if (fillAction) { await fillAction(page); } else if (typeof testValue === 'string') { await page.locator(INPUTS_SELECTOR).fill(testValue); } const valueDomProperty = await page.locator(componentName).evaluate((element: ElementType) => element._value); expect(valueDomProperty)[equalityCheck](testValue); }); }; export { testInputValueReflection };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deleonio/public-ui-kolibri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server