解决大部分用例问题

This commit is contained in:
liaoxuezhi 2022-06-02 10:00:09 +08:00
parent 406793434b
commit 5f077fc31c
133 changed files with 962 additions and 1089 deletions

5
__mocks__/svgJsMock.js Normal file
View File

@ -0,0 +1,5 @@
const React = require('react');
exports['default'] = React.forwardRef((props, ref) =>
React.createElement('icon-mock', {ref, ...props})
);

View File

@ -8,7 +8,8 @@
"start": "concurrently --restart-tries -1 npm:serve npm:dev",
"stop": "fis3 server stop",
"dev": "fis3 release -cwd ./public",
"deploy-gh-page": "sh ./deploy-gh-pages.sh"
"deploy-gh-page": "sh ./deploy-gh-pages.sh",
"test": "npm test --workspaces"
},
"devDependencies": {
"fis-optimizer-terser": "^1.0.1",
@ -25,5 +26,40 @@
"fis3-prepackager-stand-alone-pack": "^1.0.0",
"fis3-preprocessor-js-require-css": "^0.1.3",
"fis3-preprocessor-js-require-file": "^0.1.3"
},
"jest": {
"testEnvironment": "jsdom",
"collectCoverageFrom": [
"src/**/*"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"transform": {
"\\.(ts|tsx)$": "ts-jest"
},
"setupFiles": [
"jest-canvas-mock"
],
"testRegex": "/.*\\.test\\.(ts|tsx|js)$",
"moduleNameMapper": {
"\\.(css|less|sass|scss)$": "<rootDir>/__mocks__/styleMock.js",
"\\.(svg)$": "<rootDir>/__mocks__/svgMock.js",
"\\.svg\\.js$": "<rootDir>/__mocks__/svgJsMock.js"
},
"setupFilesAfterEnv": [
"<rootDir>/packages/amis-core/__tests__/jest.setup.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/.rollup.cache/"
],
"globals": {
"ts-jest": {
"diagnostics": false
}
}
}
}

View File

@ -5,6 +5,13 @@ const moment = require('moment');
moment.tz.setDefault('Asia/Shanghai');
const cleanup = require('@testing-library/react').cleanup;
// https://github.com/nrwl/nx/issues/1178
// 解决jest 运行的时候报:
// ReferenceError: DragEvent is not defined
Object.defineProperty(window, 'DragEvent', {
value: class DragEvent {}
});
global.beforeAll(() => {
console.warn = msg => {
// warning 先关了,实在太吵。

View File

@ -77,11 +77,11 @@
],
"testRegex": "/.*\\.test\\.(ts|tsx|js)$",
"moduleNameMapper": {
"\\.(css|less|sass|scss)$": "<rootDir>/../__mocks__/styleMock.js",
"\\.(svg)$": "<rootDir>/../__mocks__/svgMock.js"
"\\.(css|less|sass|scss)$": "<rootDir>/../../__mocks__/styleMock.js",
"\\.(svg)$": "<rootDir>/../../__mocks__/svgMock.js"
},
"setupFilesAfterEnv": [
"<rootDir>/__tests__/jest.setup.js"
"<rootDir>/../amis-core/__tests__/jest.setup.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
@ -89,35 +89,7 @@
],
"globals": {
"ts-jest": {
"diagnostics": false,
"tsconfig": {
"module": "commonjs",
"target": "es5",
"lib": [
"es6",
"dom",
"ES2015"
],
"sourceMap": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": ".",
"importHelpers": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceRoot": ".",
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": false,
"typeRoots": [
"./node_modules/@types",
"./types"
],
"skipLibCheck": true
}
"diagnostics": false
}
}
}

View File

@ -93,6 +93,7 @@ export {
updateEnv,
Renderer,
RendererProps,
RenderOptions,
RendererEnv,
EnvContext,
RegisterStore,

View File

@ -89,35 +89,7 @@
],
"globals": {
"ts-jest": {
"diagnostics": false,
"tsconfig": {
"module": "commonjs",
"target": "es5",
"lib": [
"es6",
"dom",
"ES2015"
],
"sourceMap": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": ".",
"importHelpers": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceRoot": ".",
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": false,
"typeRoots": [
"./node_modules/@types",
"./types"
],
"skipLibCheck": true
}
"diagnostics": false
}
}
}

View File

@ -1,643 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`factory custom not found 2! 1`] = `
<div>
<div>
Not Found
</div>
</div>
`;
exports[`factory custom not found 3! 1`] = `
<div>
<div>
Not Found
</div>
</div>
`;
exports[`factory custom not found! 1`] = `
<div>
<div>
Not Found
</div>
</div>
`;
exports[`factory load Renderer on need 1`] = `
<div>
<div>
This is Custom Renderer2, a is
23
</div>
</div>
`;
exports[`factory unregistered Renderer 1`] = `
<div>
<div
class="cxd-Alert cxd-Alert--danger"
>
<div
class="cxd-Alert-content"
>
<div
class="cxd-Alert-desc"
>
<p>
Error: 找不到对应的渲染器
</p>
<p>
Path:
my-renderer
</p>
<pre>
<code>
{
"type": "my-renderer",
"a": 23
}
</code>
</pre>
</div>
</div>
</div>
</div>
`;
exports[`factory:definitions 1`] = `
<div>
<div
class="cxd-Page"
>
<div
class="cxd-Page-content"
>
<div
class="cxd-Page-main"
>
<div
class="cxd-Page-header"
>
<h2
class="cxd-Page-title"
>
<span
class="cxd-TplField"
>
<span>
引用
</span>
</span>
</h2>
</div>
<div
class="cxd-Page-body"
>
<div
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
style="position: relative;"
>
<div
class="cxd-Panel-heading"
>
<h3
class="cxd-Panel-title"
>
<span
class="cxd-TplField"
>
<span>
表单
</span>
</span>
</h3>
</div>
<div
class="cxd-Panel-body"
>
<form
class="cxd-Form cxd-Form--normal"
novalidate=""
>
<input
style="display: none;"
type="submit"
/>
<div
class="cxd-Form-item cxd-Form-item--normal"
data-role="form-item"
>
<label
class="cxd-Form-label"
>
<span>
<span
class="cxd-TplField"
>
<span>
text2
</span>
</span>
</span>
</label>
<div
class="cxd-Form-control cxd-TextControl"
>
<div
class="cxd-TextControl-input"
>
<input
autocomplete="off"
class=""
name="ref1"
placeholder=""
size="10"
type="text"
value="ref value"
/>
</div>
</div>
<div
class="cxd-Remark cxd-Form-remark"
>
<span
class="cxd-Remark-icon"
>
<icon-mock
classname=" icon-warning-mark"
icon="warning-mark"
/>
</span>
</div>
</div>
<div
class="cxd-Form-item cxd-Form-item--normal"
data-role="form-item"
>
<label
class="cxd-Form-label"
>
<span>
<span
class="cxd-TplField"
>
<span>
combo
</span>
</span>
</span>
</label>
<div
class="cxd-ComboControl cxd-Form-control"
>
<div
class="cxd-Combo cxd-Combo--multi cxd-Combo--ver"
>
<div
class="cxd-Combo-items"
>
<div
class="cxd-Combo-item"
>
<div
class="cxd-Combo-itemInner"
>
<div
class="cxd-Form cxd-Form--normal cxd-Combo-form"
novalidate=""
>
<input
style="display: none;"
type="submit"
/>
<div
class="cxd-Form-item cxd-Form-item--normal"
data-role="form-item"
>
<label
class="cxd-Form-label"
>
<span>
<span
class="cxd-TplField"
>
<span>
combo 1
</span>
</span>
</span>
</label>
<div
class="cxd-Form-control cxd-TextControl"
>
<div
class="cxd-TextControl-input"
>
<input
autocomplete="off"
class=""
name="key"
placeholder=""
size="10"
type="text"
value=""
/>
</div>
</div>
</div>
<div
class="cxd-Form-item cxd-Form-item--normal"
data-role="form-item"
>
<label
class="cxd-Form-label"
>
<span>
<span
class="cxd-TplField"
>
<span>
combo 2
</span>
</span>
</span>
</label>
<div
class="cxd-Form-control cxd-TextControl"
>
<div
class="cxd-TextControl-input"
>
<input
autocomplete="off"
class=""
name="value"
placeholder=""
size="10"
type="text"
value="ref value"
/>
</div>
</div>
<div
class="cxd-Remark cxd-Form-remark"
>
<span
class="cxd-Remark-icon"
>
<icon-mock
classname=" icon-warning-mark"
icon="warning-mark"
/>
</span>
</div>
</div>
<div
class="cxd-Form-item cxd-Form-item--normal"
data-role="form-item"
>
<label
class="cxd-Form-label"
>
<span>
<span
class="cxd-TplField"
>
<span>
children
</span>
</span>
</span>
</label>
<div
class="cxd-Remark cxd-Form-remark"
>
<span
class="cxd-Remark-icon"
>
<icon-mock
classname=" icon-warning-mark"
icon="warning-mark"
/>
</span>
</div>
</div>
</div>
</div>
<a
class="cxd-Combo-delBtn "
data-position="bottom"
data-tooltip="删除"
>
<icon-mock
classname="icon icon-status-close"
icon="status-close"
/>
</a>
</div>
</div>
<div
class="cxd-Combo-toolbar"
>
<button
class="cxd-Button cxd-Button--default cxd-Combo-addBtn"
type="button"
>
<icon-mock
classname="icon icon-plus"
icon="plus"
/>
<span>
新增
</span>
</button>
</div>
</div>
</div>
<div
class="cxd-Remark cxd-Form-remark"
>
<span
class="cxd-Remark-icon"
>
<icon-mock
classname=" icon-warning-mark"
icon="warning-mark"
/>
</span>
</div>
</div>
</form>
</div>
<div
class="resize-sensor"
style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
class="resize-sensor-expand"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0px; top: 0px; width: 10px; height: 10px;"
/>
</div>
<div
class="resize-sensor-shrink"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0; top: 0; width: 200%; height: 200%"
/>
</div>
<div
class="resize-sensor-appear"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;animation-name: apearSensor; animation-duration: 0.2s;"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
`;
exports[`factory:definitions override 1`] = `
<div>
<div
class="cxd-Page"
>
<div
class="cxd-Page-content"
>
<div
class="cxd-Page-main"
>
<div
class="cxd-Page-header"
>
<h2
class="cxd-Page-title"
>
<span
class="cxd-TplField"
>
<span>
引用
</span>
</span>
</h2>
</div>
<div
class="cxd-Page-body"
>
<div
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
style="position: relative;"
>
<div
class="cxd-Panel-heading"
>
<h3
class="cxd-Panel-title"
>
<span
class="cxd-TplField"
>
<span>
表单
</span>
</span>
</h3>
</div>
<div
class="cxd-Panel-body"
>
<form
class="cxd-Form cxd-Form--normal"
novalidate=""
>
<input
style="display: none;"
type="submit"
/>
<div
class="cxd-Form-item cxd-Form-item--normal"
data-role="form-item"
>
<label
class="cxd-Form-label"
>
<span>
<span
class="cxd-TplField"
>
<span>
text2
</span>
</span>
</span>
</label>
<div
class="cxd-Form-control cxd-TextControl"
>
<div
class="cxd-TextControl-input"
>
<input
autocomplete="off"
class=""
name="ref1"
placeholder=""
size="10"
type="text"
value=""
/>
</div>
</div>
<div
class="cxd-Remark cxd-Form-remark"
>
<span
class="cxd-Remark-icon"
>
<icon-mock
classname=" icon-warning-mark"
icon="warning-mark"
/>
</span>
</div>
</div>
<div
class="cxd-Form-item cxd-Form-item--normal"
data-role="form-item"
>
<label
class="cxd-Form-label"
>
<span>
<span
class="cxd-TplField"
>
<span>
combo
</span>
</span>
</span>
</label>
<div
class="cxd-CheckboxesControl cxd-Form-control is-inline"
>
<label
class="cxd-Checkbox cxd-Checkbox--checkbox cxd-Checkbox--full"
>
<input
checked=""
type="checkbox"
/>
<i />
<span
class=""
>
Option A
</span>
</label>
<label
class="cxd-Checkbox cxd-Checkbox--checkbox cxd-Checkbox--full"
>
<input
type="checkbox"
/>
<i />
<span
class=""
>
Option B
</span>
</label>
</div>
<div
class="cxd-Remark cxd-Form-remark"
>
<span
class="cxd-Remark-icon"
>
<icon-mock
classname=" icon-warning-mark"
icon="warning-mark"
/>
</span>
</div>
</div>
</form>
</div>
<div
class="resize-sensor"
style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
class="resize-sensor-expand"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0px; top: 0px; width: 10px; height: 10px;"
/>
</div>
<div
class="resize-sensor-shrink"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0; top: 0; width: 200%; height: 200%"
/>
</div>
<div
class="resize-sensor-appear"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;animation-name: apearSensor; animation-duration: 0.2s;"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
`;
exports[`factory:registerRenderer 1`] = `
<div>
<div>
This is Custom Renderer, a is
23
</div>
</div>
`;

View File

@ -1,7 +1,7 @@
import React = require('react');
import NotFound from '../../../amis-ui/src/components/404';
import {NotFound} from 'amis-ui';
import * as renderer from 'react-test-renderer';
import '../../src/themes/default';
import '../../src';
import {render, fireEvent, cleanup} from '@testing-library/react';
afterEach(cleanup);

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv, wait} from '../helper';
test('EventAction:ajax', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('EventAction:copy', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('EventAction:custom', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv, wait} from '../helper';
test('EventAction:dialog', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('EventAction:disabled', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv, wait} from '../helper';
test('EventAction:drawer', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('EventAction:email', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('EventAction:hidden', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('EventAction:prevent', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('EventAction:action', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('EventAction:toast', async () => {

View File

@ -1,6 +1,6 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('EventAction:url & link', async () => {

View File

@ -1,5 +1,5 @@
import {waitFor} from '@testing-library/react';
import {RenderOptions} from '../src/factory';
import {RenderOptions} from '../src';
// jest.useFakeTimers 会修改 global 的 setTimeout 所以需要把原始的记录下来。
const timerFn = (global as any).originSetTimeout || setTimeout;

View File

@ -8,9 +8,9 @@ import {
screen,
waitFor
} from '@testing-library/react';
import {render as amisRender} from '../../src/index';
import {render as amisRender} from '../../src';
import {makeEnv, wait} from '../helper';
import '../../src/themes/default';
import '../../src';
afterEach(cleanup);

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:alert', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:anchorNav', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:avatar test', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv, wait} from '../helper';
import 'jest-canvas-mock';
@ -19,7 +19,9 @@ test('Renderer:bar-code', async () => {
makeEnv({})
)
);
await waitFor(() => expect(container.querySelector('.cxd-BarCode')).toBeInTheDocument());
await waitFor(() =>
expect(container.querySelector('.cxd-BarCode')).toBeInTheDocument()
);
expect(container).toMatchSnapshot();
});

View File

@ -1,7 +1,7 @@
import React = require('react');
import {fireEvent, render, screen} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
import * as renderer from 'react-test-renderer';

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:button-toolbar', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv, wait} from '../helper';
import rows from '../mockData/rows';

View File

@ -1,8 +1,8 @@
import React = require('react');
import {render} from '@testing-library/react';
import * as renderer from 'react-test-renderer';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:card', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, waitFor} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv, wait} from '../helper';
test('Renderer:carousel', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:container', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:custom', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
import moment from 'moment';

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:dropdown-button', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:each', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:flex', () => {

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {wait, makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, waitForElementToBeRemoved} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:chained-select', async () => {

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:city', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:color', async () => {

View File

@ -6,8 +6,8 @@ import {
waitFor,
act
} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:combo', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {fireEvent, render, screen} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
const testSchema = {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:container', async () => {

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -2,8 +2,8 @@ import React = require('react');
import PageRenderer from '../../../../amis-core/src/renderers/Form';
import * as renderer from 'react-test-renderer';
import {render, fireEvent, cleanup, getByText} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import moment from 'moment';

View File

@ -2,8 +2,8 @@ import React = require('react');
import PageRenderer from '../../../../amis-core/src/renderers/Form';
import * as renderer from 'react-test-renderer';
import {render, fireEvent, cleanup, getByText} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import moment from 'moment';

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:fieldSet', async () => {

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, fireEvent, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {wait, makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:formula', async () => {

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,7 +1,7 @@
import React = require('react');
import {fireEvent, render} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender, setIconVendor} from '../../../src/index';
import '../../../src';
import {render as amisRender, setIconVendor} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:icon-picker', async () => {

View File

@ -8,10 +8,10 @@ import {
getByText,
waitFor
} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {wait, makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
import {createMemoryHistory} from 'history';
// mock getComputedStyle

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();
@ -180,7 +180,7 @@ test('Form:initData:remote', async () => {
{
type: 'text',
name: 'a',
label: 'Label',
label: 'Label'
},
{
type: 'text',

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, cleanup, screen} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:inputArray', async () => {

View File

@ -2,8 +2,8 @@ import React = require('react');
import PageRenderer from '../../../../amis-core/src/renderers/Form';
import * as renderer from 'react-test-renderer';
import {render, fireEvent, cleanup, getByText} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import moment from 'moment';

View File

@ -1,7 +1,7 @@
import React = require('react');
import {fireEvent, render, screen} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:input-formula', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:fieldSet', async () => {

View File

@ -2,8 +2,8 @@ import React = require('react');
import PageRenderer from '../../../../amis-core/src/renderers/Form';
import * as renderer from 'react-test-renderer';
import {render, fireEvent, waitFor, getByText} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import moment from 'moment';

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, within, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import moment from 'moment';

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, screen, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:input table', () => {

View File

@ -2,8 +2,8 @@ import React = require('react');
import PageRenderer from '../../../../amis-core/src/renderers/Form';
import * as renderer from 'react-test-renderer';
import {render, fireEvent, cleanup, getByText} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import moment from 'moment';

View File

@ -2,8 +2,8 @@ import React = require('react');
import PageRenderer from '../../../../amis-core/src/renderers/Form';
import * as renderer from 'react-test-renderer';
import {render, fireEvent, screen, within} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import moment from 'moment';

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, screen} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {createMockMediaMatcher, makeEnv, wait} from '../../helper';
import {act} from 'react-dom/test-utils';

View File

@ -1,8 +1,8 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import '../../../src';
import moment from 'moment';
import {render as amisRender} from '../../../src/index';
import {render as amisRender} from '../../../src';
import {createMockMediaMatcher, makeEnv} from '../../helper';
let originalMatchMedia: any;

View File

@ -1,8 +1,8 @@
import React = require('react');
import {render, fireEvent, screen} from '@testing-library/react';
import '../../../src/themes/default';
import '../../../src';
import {render as amisRender} from '../../../src/index';
import {render as amisRender} from '../../../src';
import {createMockMediaMatcher, makeEnv} from '../../helper';
let originalMatchMedia: any;

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:number', async () => {

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:range', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:rating', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:repeat', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, screen, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:select menutpl', () => {

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:tabs-transfer', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, cleanup, screen} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:TabsTransferPicker', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:textarea', async () => {

View File

@ -1,9 +1,9 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
import {clearStoresCache} from '../../../src/factory';
import {clearStoresCache} from 'amis';
afterEach(() => {
cleanup();

View File

@ -2,8 +2,8 @@ import React = require('react');
import PageRenderer from '../../../../amis-core/src/renderers/Form';
import * as renderer from 'react-test-renderer';
import {render, fireEvent, cleanup, getByText} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
test('Renderer:time', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:transfer', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render, cleanup} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('Renderer:usersselect', async () => {

View File

@ -6,8 +6,8 @@ import {
getByText,
waitFor
} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, wait} from '../../helper';
/**

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:grid2d', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:gridnav', () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:hbox', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:iframe', async () => {

View File

@ -1,7 +1,7 @@
import React = require('react');
import {render} from '@testing-library/react';
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:image', async () => {

Some files were not shown because too many files have changed in this diff Show More