Skip to content

Commit 0f75e7c

Browse files
authored
test: 修改测试库为@testing-library/react (#69)
* test: 修改测试库为@testing-library/react,删除enzyme * fix: 修改eslint报错
1 parent 352ff33 commit 0f75e7c

File tree

83 files changed

+4360
-9865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4360
-9865
lines changed

packages/rc-cli/cjs/jest.config.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const DEFAULT_CONFIG = {
2626
collectCoverage: true,
2727
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!**/demo/**', '!**/test/**'],
2828
coverageDirectory: './tests/coverage',
29-
snapshotSerializers: ['enzyme-to-json/serializer'],
3029
};
3130

3231
function readRootConfig() {

packages/rc-cli/cjs/jest.setup.cjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
const Enzyme = require('enzyme');
2-
const Adapter = require('@wojtekmaj/enzyme-adapter-react-17');
31

4-
Enzyme.configure({ adapter: new Adapter() });

packages/rc-cli/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"@testing-library/react": "^12.1.2",
4242
"@vant/touch-emulator": "^1.3.2",
4343
"@vitejs/plugin-react": "^2.0.1",
44-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
4544
"address": "^1.1.2",
4645
"autoprefixer": "9.7.5",
4746
"babel-plugin-import": "^1.13.1",
@@ -52,8 +51,6 @@
5251
"commander": "^9.4.0",
5352
"consola": "^2.15.3",
5453
"conventional-changelog": "^3.1.24",
55-
"enzyme": "^3.11.0",
56-
"enzyme-to-json": "^3.6.1",
5754
"esbuild": "^0.14.54",
5855
"execa": "^5.1.1",
5956
"fast-glob": "^3.2.4",

packages/rc-ui-lib/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ module.exports = {
1010
'!**/**/PropsType.ts',
1111
'!**/test/**',
1212
],
13-
// testMatch: ['**/badge/__test__/**/*.[jt]s?(x)'],
13+
// testMatch: ['**/image-preview/__test__/**/*.spec.[jt]s?(x)'],
1414
};

packages/rc-ui-lib/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
"@rancui/cli": "workspace:*",
6464
"@rancui/linter": "workspace:*",
6565
"@testing-library/react": "^12.1.2",
66-
"@types/enzyme": "^3.10.12",
67-
"@types/enzyme-to-json": "^1.5.4",
6866
"@types/jest": "^27.0.3",
6967
"@types/react": "^17.0.3",
7068
"@types/react-dom": "^17.0.3",
Lines changed: 100 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,116 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Popup should allow to custom close icon with closeIcon prop 1`] = `
4-
Array [
5-
<Icon
6-
className="rc-action-sheet__close"
7-
name="success"
8-
onClick={[Function]}
9-
tag="i"
4+
<div
5+
class="rc-popup rc-popup--round rc-popup--bottom rc-safe-area-bottom rc-action-sheet"
6+
style="z-index: 2000; transition-duration: 300ms;"
7+
>
8+
<div
9+
class="rc-action-sheet__header"
1010
>
11-
<Badge
12-
className="rc-action-sheet__close van-icon van-icon-success"
13-
onClick={[Function]}
14-
position="top-right"
15-
showZero={true}
16-
style={
17-
Object {
18-
"color": undefined,
19-
"fontSize": undefined,
20-
}
21-
}
22-
tag="i"
11+
Title
12+
<i
13+
class="rc-badge__wrapper rc-action-sheet__close van-icon van-icon-success"
14+
/>
15+
</div>
16+
<div
17+
class="rc-action-sheet__content"
18+
/>
19+
</div>
20+
`;
21+
22+
exports[`Popup should allow to custom close icon with closeIcon prop 2`] = `
23+
<div
24+
class="rc-popup rc-popup--round rc-popup--bottom rc-safe-area-bottom rc-action-sheet"
25+
style="z-index: 2000; transition-duration: 300ms;"
26+
>
27+
<div
28+
class="rc-action-sheet__header"
29+
>
30+
Title
31+
<div
32+
class="rc-action-sheet__close"
2333
>
24-
<i
25-
className="rc-badge__wrapper rc-action-sheet__close van-icon van-icon-success"
26-
onClick={[Function]}
27-
style={
28-
Object {
29-
"color": undefined,
30-
"fontSize": undefined,
31-
}
32-
}
33-
/>
34-
</Badge>
35-
</Icon>,
36-
<Badge
37-
className="rc-action-sheet__close van-icon van-icon-success"
38-
onClick={[Function]}
39-
position="top-right"
40-
showZero={true}
41-
style={
42-
Object {
43-
"color": undefined,
44-
"fontSize": undefined,
45-
}
46-
}
47-
tag="i"
34+
<i>
35+
X
36+
</i>
37+
</div>
38+
</div>
39+
<div
40+
class="rc-action-sheet__content"
41+
/>
42+
</div>
43+
`;
44+
45+
exports[`Popup should render default slot correctly 1`] = `
46+
<div
47+
class="rc-popup rc-popup--round rc-popup--bottom rc-safe-area-bottom rc-action-sheet"
48+
style="z-index: 2000; transition-duration: 300ms;"
49+
>
50+
<div
51+
class="rc-action-sheet__header"
4852
>
53+
Title
4954
<i
50-
className="rc-badge__wrapper rc-action-sheet__close van-icon van-icon-success"
51-
onClick={[Function]}
52-
style={
53-
Object {
54-
"color": undefined,
55-
"fontSize": undefined,
56-
}
57-
}
55+
class="rc-badge__wrapper rc-action-sheet__close van-icon van-icon-cross"
5856
/>
59-
</Badge>,
60-
<i
61-
className="rc-badge__wrapper rc-action-sheet__close van-icon van-icon-success"
62-
onClick={[Function]}
63-
style={
64-
Object {
65-
"color": undefined,
66-
"fontSize": undefined,
67-
}
68-
}
69-
/>,
70-
]
57+
</div>
58+
<div
59+
class="rc-action-sheet__content"
60+
>
61+
Default
62+
</div>
63+
</div>
7164
`;
7265

73-
exports[`Popup should render default slot correctly 1`] = `"<div style=\\"z-index: 2000; animation-duration: 300ms;\\" class=\\"rc-overlay\\"></div><div style=\\"z-index: 2000; transition-duration: 300ms;\\" class=\\"rc-popup rc-popup--round rc-popup--bottom rc-safe-area-bottom rc-action-sheet\\"><div class=\\"rc-action-sheet__header\\">Title<i class=\\"rc-badge__wrapper rc-action-sheet__close van-icon van-icon-cross\\"></i></div><div class=\\"rc-action-sheet__content\\">Default</div></div>"`;
74-
7566
exports[`Popup should render description correctly 1`] = `
7667
<div
77-
className="rc-action-sheet__description"
68+
class="rc-popup rc-popup--round rc-popup--bottom rc-safe-area-bottom rc-action-sheet"
69+
style="z-index: 2000; transition-duration: 300ms;"
7870
>
79-
This is a description
71+
<div
72+
class="rc-action-sheet__description"
73+
>
74+
This is a description
75+
</div>
76+
<div
77+
class="rc-action-sheet__content"
78+
/>
8079
</div>
8180
`;
8281

83-
exports[`Popup should render subname correctly 1`] = `"<button type=\\"button\\" class=\\"rc-action-sheet__item\\"><span class=\\"rc-action-sheet__name\\">Option</span><div class=\\"rc-action-sheet__subname\\">Subname</div></button>"`;
82+
exports[`Popup should render subname correctly 1`] = `
83+
<div
84+
class="rc-popup rc-popup--round rc-popup--bottom rc-safe-area-bottom rc-action-sheet"
85+
style="z-index: 2000; transition-duration: 300ms;"
86+
>
87+
<div
88+
class="rc-action-sheet__content"
89+
>
90+
<button
91+
class="rc-action-sheet__item"
92+
type="button"
93+
>
94+
<span
95+
class="rc-action-sheet__name"
96+
>
97+
Option
98+
</span>
99+
<div
100+
class="rc-action-sheet__subname"
101+
>
102+
Subname
103+
</div>
104+
</button>
105+
</div>
106+
<div
107+
class="rc-action-sheet__gap"
108+
/>
109+
<button
110+
class="rc-action-sheet__cancel"
111+
type="button"
112+
>
113+
Cancel
114+
</button>
115+
</div>
116+
`;

0 commit comments

Comments
 (0)