test: add some testcase

pull/13/head
moonrailgun 4 years ago
parent fd533d5b99
commit d96d137893

@ -44,6 +44,7 @@
"gulp-sort": "^2.0.0",
"husky": "^7.0.0",
"i18next-scanner": "^3.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.0.6",
"lint-staged": "^11.0.0",
"prettier": "^2.3.2",

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import React from 'react';
import { AlertErrorView } from '../AlertErrorView';
describe('AlertErrorView', () => {
test('render', () => {
const wrapper = render(<AlertErrorView error={new Error('Dummy Error')} />);
expect(wrapper.container).toMatchSnapshot();
});
});

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import React from 'react';
import { Highlight } from '../Highlight';
describe('Highlight', () => {
test('render', () => {
const wrapper = render(<Highlight>Any Text</Highlight>);
expect(wrapper.container).toMatchSnapshot();
});
});

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import React from 'react';
import { IconBtn } from '../IconBtn';
describe('IconBtn', () => {
test('render', () => {
const wrapper = render(<IconBtn icon="mdi-close" />);
expect(wrapper.container).toMatchSnapshot();
});
});

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import React from 'react';
import { IsDeveloping } from '../IsDeveloping';
describe('IsDeveloping', () => {
test('render', () => {
const wrapper = render(<IsDeveloping />);
expect(wrapper.container).toMatchSnapshot();
});
});

@ -0,0 +1,19 @@
import { render } from '@testing-library/react';
import React from 'react';
import { PillTabs, PillTabPane } from '../PillTabs';
describe('PillTabs', () => {
test('render', () => {
const wrapper = render(
<PillTabs>
<PillTabPane tab="t1" key="1">
1
</PillTabPane>
<PillTabPane tab="t2" key="2">
2
</PillTabPane>
</PillTabs>
);
expect(wrapper.container).toMatchSnapshot();
});
});

@ -0,0 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AlertErrorView render 1`] = `
<div>
<div
class="ant-alert ant-alert-error ant-alert-with-description ant-alert-no-icon"
data-show="true"
role="alert"
>
<div
class="ant-alert-content"
>
<div
class="ant-alert-message"
>
Error
</div>
<div
class="ant-alert-description"
>
Dummy Error
</div>
</div>
</div>
</div>
`;

@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Highlight render 1`] = `
<div>
<span
class="bg-black bg-opacity-20 rounded py-1 px-2"
>
Any Text
</span>
</div>
`;

@ -0,0 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`IconBtn render 1`] = `
<div>
<button
class="ant-btn ant-btn-circle ant-btn-icon-only border-0 bg-black bg-opacity-30 text-white text-opacity-80 hover:text-opacity-100 hover:bg-opacity-60"
type="button"
>
<span />
</button>
</div>
`;

@ -0,0 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`IsDeveloping render 1`] = `
<div>
<div
class="text-white w-full h-full flex items-center justify-center flex-col"
>
<span />
<p
class="text-2xl"
>
该功能暂未开放
</p>
</div>
</div>
`;

@ -0,0 +1,117 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PillTabs render 1`] = `
<div>
<div
class="ant-tabs ant-tabs-top ant-tabs-card pill-tabs"
>
<div
class="ant-tabs-nav"
role="tablist"
>
<div
class="ant-tabs-nav-wrap"
>
<div
class="ant-tabs-nav-list"
style="transform: translate(0px, 0px);"
>
<div
class="ant-tabs-tab ant-tabs-tab-active"
>
<div
aria-controls="rc-tabs-test-panel-1"
aria-selected="true"
class="ant-tabs-tab-btn"
id="rc-tabs-test-tab-1"
role="tab"
tabindex="0"
>
t1
</div>
</div>
<div
class="ant-tabs-tab"
>
<div
aria-controls="rc-tabs-test-panel-2"
aria-selected="false"
class="ant-tabs-tab-btn"
id="rc-tabs-test-tab-2"
role="tab"
tabindex="0"
>
t2
</div>
</div>
<div
class="ant-tabs-ink-bar ant-tabs-ink-bar-animated"
/>
</div>
</div>
<div
class="ant-tabs-nav-operations ant-tabs-nav-operations-hidden"
>
<button
aria-controls="rc-tabs-test-more-popup"
aria-expanded="false"
aria-haspopup="listbox"
aria-hidden="true"
class="ant-tabs-nav-more"
id="rc-tabs-test-more"
style="visibility: hidden; order: 1;"
tabindex="-1"
type="button"
>
<span
aria-label="ellipsis"
class="anticon anticon-ellipsis"
role="img"
>
<svg
aria-hidden="true"
data-icon="ellipsis"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"
/>
</svg>
</span>
</button>
</div>
</div>
<div
class="ant-tabs-content-holder"
>
<div
class="ant-tabs-content ant-tabs-content-top ant-tabs-content-animated"
>
<div
aria-hidden="false"
aria-labelledby="rc-tabs-test-tab-1"
class="ant-tabs-tabpane ant-tabs-tabpane-active"
id="rc-tabs-test-panel-1"
role="tabpanel"
tabindex="0"
>
1
</div>
<div
aria-hidden="true"
aria-labelledby="rc-tabs-test-tab-2"
class="ant-tabs-tabpane"
id="rc-tabs-test-panel-2"
role="tabpanel"
style="visibility: hidden; height: 0px; overflow-y: hidden;"
tabindex="-1"
/>
</div>
</div>
</div>
</div>
`;

@ -4225,6 +4225,11 @@ hard-rejection@^2.1.0:
resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883"
integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==
harmony-reflect@^1.4.6:
version "1.6.2"
resolved "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.2.tgz#31ecbd32e648a34d030d86adb67d4d47547fe710"
integrity sha512-HIp/n38R9kQjDEziXyDTuW3vvoxxyxjxFzXLrBr18uB47GnSt+G9D29fqrpM5ZkspMcPICud3XsBJQ4Y2URg8g==
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
@ -4562,6 +4567,13 @@ icss-utils@^5.0.0, icss-utils@^5.1.0:
resolved "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae"
integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==
identity-obj-proxy@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz#94d2bda96084453ef36fbc5aaec37e0f79f1fc14"
integrity sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ=
dependencies:
harmony-reflect "^1.4.6"
ieee754@^1.1.13:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"

Loading…
Cancel
Save