Skip to content

Commit

Permalink
fix: update script for testing demo
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeJim committed Jul 31, 2023
1 parent 715c332 commit 9f78de7
Show file tree
Hide file tree
Showing 59 changed files with 80 additions and 61 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"cover": "jest --coverage",
"test": "jest && jest -c jest.e2e.config.js",
"test:snap-update": "npm run test:unit -- -u",
"test:demo": "node gen-demo-test.js",
"test:demo": "node script/gen-demo-test.js",
"test:unit": "jest",
"test:e2e": "jest -c jest.e2e.config.js",
"badge": "node script/coverage-badge.js",
Expand Down
8 changes: 4 additions & 4 deletions gen-demo-test.js → script/gen-demo-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const upperFirst = require('lodash/upperFirst');
// };

const CONFIG = {
sourcePath: path.resolve(__dirname, 'src'),
targetPath: path.resolve(__dirname, 'src'),
defaultTemplate: ['import simulate from \'miniprogram-simulate\';', 'import path from \'path\';'].join('\n'),
sourcePath: path.resolve(__dirname, '../src'),
targetPath: path.resolve(__dirname, '../src'),
defaultTemplate: ["import path from 'path';", "import simulate from 'miniprogram-simulate';"].join('\n'),
};

/*
Expand Down Expand Up @@ -115,7 +115,7 @@ function main() {
outputOneComponentTestFile(componentFolder, demoFiles);
}
});
}
};
files.forEach(generation);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['align', 'grid', 'list', 'status'];

Expand Down
2 changes: 1 addition & 1 deletion src/avatar/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['action', 'badge-avatar', 'character-avatar', 'exhibition', 'icon-avatar', 'image-avatar', 'size'];

Expand Down
2 changes: 1 addition & 1 deletion src/back-top/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'half-round'];

Expand Down
2 changes: 1 addition & 1 deletion src/badge/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'size', 'theme'];

Expand Down
2 changes: 1 addition & 1 deletion src/button/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'block-btn', 'disabled', 'ghost-btn', 'group-btn', 'icon-btn', 'shape', 'size', 'theme'];

Expand Down
2 changes: 1 addition & 1 deletion src/calendar/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'custom-button', 'custom-range', 'custom-text', 'multiple', 'range', 'without-popup'];

Expand Down
2 changes: 1 addition & 1 deletion src/cascader/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'keys', 'theme-tab', 'with-title', 'with-value'];

Expand Down
2 changes: 1 addition & 1 deletion src/cell/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'multiple', 'theme'];

Expand Down
2 changes: 1 addition & 1 deletion src/checkbox/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['all', 'base', 'card', 'horizontal', 'right', 'special', 'status', 'type'];

Expand Down
19 changes: 19 additions & 0 deletions src/col/__test__/demo.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'offset'];

describe('Col', () => {
mapper.forEach((demoName) => {
it(`Col ${demoName} demo works fine`, () => {
const id = load(path.resolve(__dirname, `../../col/_example/${demoName}/index`), demoName);
const container = simulate.render(id);
container.attach(document.createElement('parent-wrapper'));
expect(container.toJSON()).toMatchSnapshot();
});
});
});
2 changes: 1 addition & 1 deletion src/collapse/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['accordion', 'action', 'base', 'placement', 'theme'];

Expand Down
2 changes: 1 addition & 1 deletion src/count-down/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'size'];

Expand Down
2 changes: 1 addition & 1 deletion src/date-time-picker/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['date-all', 'steps', 'time', 'year-month', 'year-month-date'];

Expand Down
2 changes: 1 addition & 1 deletion src/dialog/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'button', 'command', 'confirm', 'status', 'with-image', 'with-input'];

Expand Down
2 changes: 1 addition & 1 deletion src/divider/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'theme'];

Expand Down
2 changes: 1 addition & 1 deletion src/drawer/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'footer', 'icon-drawer', 'title'];

Expand Down
2 changes: 1 addition & 1 deletion src/dropdown-menu/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['multi', 'single', 'tree'];

Expand Down
2 changes: 1 addition & 1 deletion src/empty/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'buttonEmpty', 'imageEmpty'];

Expand Down
2 changes: 1 addition & 1 deletion src/fab/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['advance', 'base'];

Expand Down
2 changes: 1 addition & 1 deletion src/footer/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'link', 'logo'];

Expand Down
2 changes: 1 addition & 1 deletion src/grid/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['badge', 'base', 'border', 'card', 'description', 'icon-grid', 'multiple', 'scroll'];

Expand Down
2 changes: 1 addition & 1 deletion src/icon/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'custom', 'iconImage'];

Expand Down
2 changes: 1 addition & 1 deletion src/image-viewer/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'delete'];

Expand Down
2 changes: 1 addition & 1 deletion src/image/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'size', 'status'];

Expand Down
2 changes: 1 addition & 1 deletion src/indexes/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'custom'];

Expand Down
2 changes: 1 addition & 1 deletion src/input/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = [
'align',
Expand Down
2 changes: 1 addition & 1 deletion src/link/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['content', 'disabled', 'prefix', 'size', 'suffix', 'theme', 'underline'];

Expand Down
2 changes: 1 addition & 1 deletion src/loading/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'duration', 'horizontal', 'size', 'status', 'text', 'vertical'];

Expand Down
2 changes: 1 addition & 1 deletion src/message/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'theme'];

Expand Down
2 changes: 1 addition & 1 deletion src/navbar/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['back-home', 'base', 'custom-color', 'img', 'left-title', 'search'];

Expand Down
2 changes: 1 addition & 1 deletion src/notice-bar/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'custom', 'customization', 'event', 'iconDemo', 'scrolling', 'suffixIcon', 'theme'];

Expand Down
2 changes: 1 addition & 1 deletion src/overlay/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base'];

Expand Down
2 changes: 1 addition & 1 deletion src/picker/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['area', 'base', 'with-title'];

Expand Down
2 changes: 1 addition & 1 deletion src/popup/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'custom-close', 'with-title'];

Expand Down
2 changes: 1 addition & 1 deletion src/progress/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import simulate from 'miniprogram-simulate';
import path from 'path';
import simulate from 'miniprogram-simulate';

const mapper = ['base', 'circle', 'custom', 'line', 'plump', 'transition'];

Expand Down
Loading

0 comments on commit 9f78de7

Please sign in to comment.