@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
25 lines (24 loc) • 895 B
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import { h } from "@stencil/core";
import { newSpecPage } from "@stencil/core/testing";
const propsToLabel = (props) => {
return Object.entries(props)
.map(([key, value]) => `${key}=${JSON.stringify(value)}`)
.join(' ');
};
export const executeSnapshotTests = (ComponentName, components, propVariants) => {
describe(ComponentName, () => {
const testTable = propVariants.map((props) => [propsToLabel(props), props]);
it.each(testTable)('should render with %s', async (_, props) => {
const page = await newSpecPage({
components,
template: () => h(ComponentName, Object.assign({}, props)),
});
await page.waitForChanges();
expect(page.root).toMatchSnapshot();
});
});
};
//# sourceMappingURL=snapshot-testing.js.map