mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
fix: issues in imageTest.tsx
(#49826)
* chore(deps): removed deprecated `crypto@1.0.1` * fix: issues in `imageTest.tsx`
This commit is contained in:
parent
d063f562eb
commit
1d84cca4e3
@ -222,7 +222,6 @@
|
|||||||
"cli-progress": "^3.12.0",
|
"cli-progress": "^3.12.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
"crypto": "^1.0.1",
|
|
||||||
"dekko": "^0.2.1",
|
"dekko": "^0.2.1",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"dumi": "~2.4.0",
|
"dumi": "~2.4.0",
|
||||||
|
@ -42,7 +42,7 @@ export default function imageTest(
|
|||||||
let container: HTMLDivElement;
|
let container: HTMLDivElement;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const dom = new JSDOM('<!DOCTYPE html><body></body></p>', {
|
const dom = new JSDOM('<!DOCTYPE html><body></body></html>', {
|
||||||
url: 'http://localhost/',
|
url: 'http://localhost/',
|
||||||
});
|
});
|
||||||
const win = dom.window;
|
const win = dom.window;
|
||||||
@ -121,8 +121,10 @@ export default function imageTest(
|
|||||||
|
|
||||||
const { openTriggerClassName } = options;
|
const { openTriggerClassName } = options;
|
||||||
|
|
||||||
|
const requestListener = (request: any) => onRequestHandle(request as HTTPRequest);
|
||||||
|
|
||||||
MockDate.set(dayjs('2016-11-22').valueOf());
|
MockDate.set(dayjs('2016-11-22').valueOf());
|
||||||
page.on('request', onRequestHandle);
|
page.on('request', requestListener);
|
||||||
await page.goto(`file://${process.cwd()}/tests/index.html`);
|
await page.goto(`file://${process.cwd()}/tests/index.html`);
|
||||||
await page.addStyleTag({ path: `${process.cwd()}/components/style/reset.css` });
|
await page.addStyleTag({ path: `${process.cwd()}/components/style/reset.css` });
|
||||||
await page.addStyleTag({ content: '*{animation: none!important;}' });
|
await page.addStyleTag({ content: '*{animation: none!important;}' });
|
||||||
@ -194,7 +196,7 @@ export default function imageTest(
|
|||||||
},
|
},
|
||||||
html,
|
html,
|
||||||
styleStr,
|
styleStr,
|
||||||
openTriggerClassName,
|
openTriggerClassName || '',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!options.onlyViewport) {
|
if (!options.onlyViewport) {
|
||||||
@ -210,7 +212,7 @@ export default function imageTest(
|
|||||||
await fse.writeFile(path.join(snapshotPath, `${identifier}${suffix}.png`), image);
|
await fse.writeFile(path.join(snapshotPath, `${identifier}${suffix}.png`), image);
|
||||||
|
|
||||||
MockDate.reset();
|
MockDate.reset();
|
||||||
page.off('request', onRequestHandle);
|
page.off('request', requestListener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user