mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-23 18:50:06 +08:00
feat: support options
This commit is contained in:
parent
81f5bc53a4
commit
bc609d633d
@ -1,5 +1,5 @@
|
||||
import { imageDemoTest } from '../../../tests/shared/imageTest';
|
||||
|
||||
describe('Breadcrumb image', () => {
|
||||
imageDemoTest('breadcrumb', { skip: ['react-router.tsx'] });
|
||||
imageDemoTest('breadcrumb');
|
||||
});
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'button', skip: ['loading.tsx'] };
|
||||
export default { id: 'button', skip: ['loading'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'config-provider', skip: ['direction.tsx', 'theme.tsx'] };
|
||||
export default { id: 'config-provider', skip: ['direction', 'theme'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'dropdown', skip: ['dropdown-button.tsx'] };
|
||||
export default { id: 'dropdown', skip: ['dropdown-button'] };
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { imageDemoTest } from '../../../tests/shared/imageTest';
|
||||
|
||||
describe('float-button image', () => {
|
||||
imageDemoTest('float-button', { onlyViewport: ['back-top.tsx'] });
|
||||
imageDemoTest('float-button', { onlyViewport: ['back-top'] });
|
||||
});
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'float-button', onlyViewport: ['back-top.tsx'] };
|
||||
export default { id: 'float-button', onlyViewport: ['back-top'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'form', skip: ['complex-form-control.tsx'] };
|
||||
export default { id: 'form', skip: ['complex-form-control'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'icon', skip: ['basic.tsx'] };
|
||||
export default { id: 'icon', skip: ['basic'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'input', skip: ['search-input-loading.tsx'] };
|
||||
export default { id: 'input', skip: ['search-input-loading'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'layout', skip: ['fixed-sider.tsx'] };
|
||||
export default { id: 'layout', skip: ['fixed-sider'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'list', skip: ['loadmore.tsx'] };
|
||||
export default { id: 'list', skip: ['loadmore'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'popconfirm' };
|
||||
export default { id: 'popconfirm', onlyViewport: ['shift'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'popover' };
|
||||
export default { id: 'popover', onlyViewport: ['shift'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'switch', skip: ['loading.tsx'] };
|
||||
export default { id: 'switch', skip: ['loading'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'table', skip: ['virtual-list.tsx'] };
|
||||
export default { id: 'table', skip: ['virtual-list'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'tag', skip: ['status.tsx'] };
|
||||
export default { id: 'tag', skip: ['status'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'timeline', skip: ['pending.tsx'] };
|
||||
export default { id: 'timeline', skip: ['pending'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'tooltip', onlyViewport: ['shift.tsx'] };
|
||||
export default { id: 'tooltip', onlyViewport: ['shift'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'tree', skip: ['virtual-scroll.tsx', 'big-data.tsx'] };
|
||||
export default { id: 'tree', skip: ['virtual-scroll', 'big-data'] };
|
||||
|
@ -1 +1 @@
|
||||
export default { id: 'upload', skip: ['crop-image.tsx'] };
|
||||
export default { id: 'upload', skip: ['crop-image'] };
|
||||
|
@ -15,7 +15,9 @@ import type { LogLevelNames } from 'loglevel';
|
||||
|
||||
interface VisualDiffConfig {
|
||||
id: string;
|
||||
onlyViewport?: boolean;
|
||||
skip?: boolean | string[];
|
||||
onlyViewport?: boolean | string[];
|
||||
/** Open Trigger to check the popup render */
|
||||
openTriggerClassName?: string;
|
||||
}
|
||||
|
||||
@ -120,6 +122,14 @@ class BrowserAuto {
|
||||
const demoUrl = await retrieveDemoUrl(mdPath);
|
||||
const options = await retrieveConfig(mdPath);
|
||||
|
||||
const skip =
|
||||
Array.isArray(options.skip) &&
|
||||
options.skip.some((c) => path.basename(mdPath, '.md').endsWith(c));
|
||||
if (skip) {
|
||||
loglevel.info('Skip for: %s', mdPath);
|
||||
return;
|
||||
}
|
||||
|
||||
const query = new URLSearchParams();
|
||||
query.set('theme', theme);
|
||||
if (enableCssVar) {
|
||||
@ -140,7 +150,18 @@ class BrowserAuto {
|
||||
|
||||
await page.waitForSelector('.dumi-antd-demo-layout');
|
||||
|
||||
if (!options.onlyViewport) {
|
||||
const onlyViewport =
|
||||
options.onlyViewport === true ||
|
||||
(Array.isArray(options.onlyViewport) &&
|
||||
options.onlyViewport.some((c) => path.basename(mdPath, '.md').endsWith(c)));
|
||||
|
||||
loglevel.info(
|
||||
'visit: %s, onlyViewport: %s, openTriggerClassName: %s',
|
||||
pageUrl,
|
||||
onlyViewport,
|
||||
options.openTriggerClassName,
|
||||
);
|
||||
if (!onlyViewport) {
|
||||
// Get scroll height of the rendered page and set viewport
|
||||
const bodyHeight = await page.evaluate(() => document.body.scrollHeight);
|
||||
await page.setViewportSize({ width: 800, height: bodyHeight });
|
||||
@ -252,8 +273,8 @@ function parseArgs(): {
|
||||
// 增加并发
|
||||
await pAll(
|
||||
visitConfigs.map((visitConfig, i) => async () => {
|
||||
console.log(
|
||||
`处理 ${i + 1}/${mdPaths.length}: ${visitConfig.mdPath}-${visitConfig.theme}-${visitConfig.enableCssVar}`,
|
||||
loglevel.info(
|
||||
`处理 ${i + 1}/${visitConfigs.length}: ${visitConfig.mdPath} / ${visitConfig.theme} / ${visitConfig.enableCssVar}`,
|
||||
);
|
||||
return task(visitConfig);
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user