From fa4028beb77c87ea1bc2d018541561c7732488fc Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 24 Sep 2024 22:58:51 +0800 Subject: [PATCH] chore: fix emotion style missing in visual diff (#50995) --- tests/shared/imageTest.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/shared/imageTest.tsx b/tests/shared/imageTest.tsx index 4fb1a2bdd0..9d9bb7a882 100644 --- a/tests/shared/imageTest.tsx +++ b/tests/shared/imageTest.tsx @@ -2,6 +2,7 @@ import path from 'path'; import React from 'react'; // Reference: https://github.com/ant-design/ant-design/pull/24003#discussion_r427267386 import { createCache, extractStyle, StyleProvider } from '@ant-design/cssinjs'; +import { extractStaticStyle } from 'antd-style'; import dayjs from 'dayjs'; import fse from 'fs-extra'; import { globSync } from 'glob'; @@ -153,14 +154,13 @@ export default function imageTest( if (options.ssr) { html = ReactDOMServer.renderToString(element); - styleStr = extractStyle(cache); + styleStr = extractStyle(cache) + extractStaticStyle(html).map((item) => item.tag); } else { const { unmount } = render(element, { container, }); html = container.innerHTML; - styleStr = extractStyle(cache); - + styleStr = extractStyle(cache) + extractStaticStyle(html).map((item) => item.tag); // We should extract style before unmount unmount(); }