Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/migrate2vitest #1687

Merged
merged 18 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: unit test component mount
  • Loading branch information
xiaosansiji committed Oct 26, 2022
commit 7a30aa12bf0c7d7ef06ea58aef3a788a9030e7e1
400 changes: 244 additions & 156 deletions src/avatar/__tests__/__snapshots__/index.test.jsx.snap

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/avatar/__tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ describe('Avatar', () => {
return <Avatar image="https://tdesign.gtimg.com/site/avatar.jpg"></Avatar>;
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
it(':icon', () => {
const wrapper = mount({
render() {
return <div></div>;
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
it(':shape', () => {
const wrapper = mount({
Expand All @@ -32,7 +32,7 @@ describe('Avatar', () => {
);
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
it(':size', () => {
const wrapper = mount({
Expand All @@ -47,7 +47,7 @@ describe('Avatar', () => {
);
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
});

Expand All @@ -58,7 +58,7 @@ describe('Avatar', () => {
icon: '<div></div>',
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
});
});
Expand All @@ -82,7 +82,7 @@ describe('AvatarGroup', () => {
);
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
it(':collapseAvatar', () => {
const wrapper = mount({
Expand All @@ -101,7 +101,7 @@ describe('AvatarGroup', () => {
);
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
it(':max', () => {
const wrapper = mount({
Expand All @@ -117,7 +117,7 @@ describe('AvatarGroup', () => {
);
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
it(':placement', () => {
const wrapper = mount({
Expand All @@ -133,7 +133,7 @@ describe('AvatarGroup', () => {
);
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
it(':popupProps', () => {
const wrapper = mount({
Expand All @@ -149,7 +149,7 @@ describe('AvatarGroup', () => {
);
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
it(':size', () => {
const wrapper = mount({
Expand All @@ -165,7 +165,7 @@ describe('AvatarGroup', () => {
);
},
});
expect(wrapper).toMatchSnapshot();
expect(wrapper.element).toMatchSnapshot();
});
});
});
234 changes: 94 additions & 140 deletions src/badge/__tests__/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,171 +1,125 @@
// Vitest Snapshot v1

exports[`Badge > :props > :color 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
</div>
`;

exports[`Badge > :props > :count 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--circle"
>
2
</sup>
</div>
`;

exports[`Badge > :props > :count 2`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--circle"
>
2
</sup>
</div>
`;

exports[`Badge > :props > :dot 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--dot"
/>
</div>
`;

exports[`Badge > :props > :maxCount 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--circle"
>
2
</sup>
</div>
`;

exports[`Badge > :props > :offset 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--circle"
style="right: 10px; top: 10px;"
>
2
</sup>
</div>
`;

exports[`Badge > :props > :shape 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--round"
>
2
</sup>
</div>
`;

exports[`Badge > :props > :showZero 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--circle"
>
2
</sup>
</div>
`;

exports[`Badge > :props > :size 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--circle t-size-s"
>
2
</sup>
</div>
`;

exports[`Badge > <slot> > default 1`] = `
VueWrapper {
"_emitted": {
"hook:mounted": [
[],
],
},
"_emittedByOrder": [
{
"args": [],
"name": "hook:mounted",
},
],
"isFunctionalComponent": undefined,
}
<div
class="t-badge"
>
Tdesign
<sup
class="t-badge--circle"
>
2
</sup>
</div>
`;
Loading