An open source design system that's fully customizable and agent ready
TypeScript
test(AspectRatio): the fit-layer spec answers the story's remote photos locally (#9703)
Christopher Chedeau3e0934850c47
diff --git a/packages/core/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts b/packages/core/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.tsindex 2976a2212e..07f055eea0 100644--- a/packages/core/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts+++ b/packages/core/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts@@ -43,6 +43,10 @@ const TAILWIND_SETUPS = [const IMAGE ="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'/%3E";+// The local stand-in for the story's remote photos.+const PHOTO =+ "<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'/>";+type Fit = 'cover' | 'contain';let storybook: StaticServer;@@ -62,6 +66,11 @@ test.afterAll(async () => {* local source and any extra class.*/async function captureStory(page: Page, fit: Fit, mediaClass: string) {+ // The story loads its photos from picsum.photos. A slow response holds the+ // load event that `page.setContent` waits for, so a local image answers them.+ await page.route('**://picsum.photos/**', async route =>+ route.fulfill({contentType: 'image/svg+xml', body: PHOTO}),+ );await page.goto(`${storybook.origin}/iframe.html?id=core-aspectratio--fit-modes&viewMode=story`,);