Skip to content

Commit 31b7772

Browse files
committed
test: update snap
1 parent 1a6075b commit 31b7772

File tree

3 files changed

+52
-40
lines changed

3 files changed

+52
-40
lines changed

components/spin/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,71 @@
22

33
exports[`renders ./antdv-demo/docs/spin/demo/basic.md correctly 1`] = `
44
<div>
5-
<div class="ant-spin ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span></div>
5+
<div class="ant-spin ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span>
6+
<!---->
7+
</div>
68
</div>
79
`;
810

911
exports[`renders ./antdv-demo/docs/spin/demo/custom-indicator.md correctly 1`] = `
1012
<div>
11-
<div class="ant-spin ant-spin-spinning"><span role="img" aria-label="loading" class="anticon anticon-loading ant-spin-dot" style="font-size: 24px;"><svg viewBox="0 0 1024 1024" focusable="false" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" class="anticon-spin"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span></div>
12-
<div class="ant-spin ant-spin-spinning"><span role="img" aria-label="loading" class="anticon anticon-loading ant-spin-dot" style="font-size: 24px;"><svg viewBox="0 0 1024 1024" focusable="false" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" class="anticon-spin"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span></div>
13+
<div class="ant-spin-nested-loading">
14+
<div>
15+
<div class="ant-spin ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span>
16+
<!---->
17+
</div>
18+
</div>
19+
<div class="ant-spin-container ant-spin-blur"><span slot="indicator" style="font-size: 24px;" role="img" aria-label="loading" class="anticon anticon-loading"><svg class="anticon-spin" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span></div>
20+
</div>
21+
<div class="ant-spin ant-spin-spinning"><span style="font-size: 24px;" role="img" aria-label="loading" class="anticon anticon-loading ant-spin-dot"><svg class="anticon-spin" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span>
22+
<!---->
23+
</div>
1324
</div>
1425
`;
1526

1627
exports[`renders ./antdv-demo/docs/spin/demo/delayAndDebounce.md correctly 1`] = `
1728
<div>
1829
<div class="ant-spin-nested-loading">
30+
<!---->
1931
<div class="ant-spin-container">
20-
<div class="spin-content">
21-
可以点击‘切换’按钮,延迟显示 loading 效果。当 spinning 状态在 \`delay\` 时间内结束,则不显示
22-
loading 状态。
23-
</div>
32+
<div class="spin-content"> 可以点击‘切换’按钮,延迟显示 loading 效果。当 spinning 状态在 \`delay\` 时间内结束,则不显示 loading 状态。 </div>
2433
</div>
25-
</div>
26-
Loading state:<button type="button" role="switch" class="ant-switch"><span class="ant-switch-inner"></span></button>
34+
</div> Loading state:<button class="ant-switch" type="button" role="switch" aria-checked="false">
35+
<!----><span class="ant-switch-inner"><!----></span></button>
2736
</div>
2837
`;
2938

3039
exports[`renders ./antdv-demo/docs/spin/demo/inside.md correctly 1`] = `
3140
<div class="example">
32-
<div class="ant-spin ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span></div>
41+
<div class="ant-spin ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span>
42+
<!---->
43+
</div>
3344
</div>
3445
`;
3546

3647
exports[`renders ./antdv-demo/docs/spin/demo/nested.md correctly 1`] = `
3748
<div>
3849
<div class="ant-spin-nested-loading">
50+
<!---->
3951
<div class="ant-spin-container">
40-
<div class="spin-content">
41-
可以点击‘切换’按钮,控制本区域的spin展示。
42-
</div>
52+
<div class="spin-content"> 可以点击‘切换’按钮,控制本区域的spin展示。 </div>
4353
</div>
44-
</div>
45-
Loading state:<button type="button" role="switch" class="ant-switch"><span class="ant-switch-inner"></span></button>
54+
</div> Loading state:<button class="ant-switch" type="button" role="switch" aria-checked="false">
55+
<!----><span class="ant-switch-inner"><!----></span></button>
4656
</div>
4757
`;
4858

4959
exports[`renders ./antdv-demo/docs/spin/demo/size.md correctly 1`] = `
5060
<div>
51-
<div class="ant-spin ant-spin-sm ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span></div>
52-
<div class="ant-spin ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span></div>
53-
<div class="ant-spin ant-spin-lg ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span></div>
61+
<div class="ant-spin ant-spin-sm ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span>
62+
<!---->
63+
</div>
64+
<div class="ant-spin ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span>
65+
<!---->
66+
</div>
67+
<div class="ant-spin ant-spin-lg ant-spin-spinning"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span>
68+
<!---->
69+
</div>
5470
</div>
5571
`;
5672

@@ -63,9 +79,7 @@ exports[`renders ./antdv-demo/docs/spin/demo/tip.md correctly 1`] = `
6379
</div>
6480
</div>
6581
<div class="ant-spin-container ant-spin-blur">
66-
<div class="spin-content">
67-
我的描述文案是自定义的。。。
68-
</div>
82+
<div class="spin-content"> 我的描述文案是自定义的。。。 </div>
6983
</div>
7084
</div>
7185
</div>
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`renders ./antdv-demo/docs/switch/demo/basic.md correctly 1`] = `
4-
<div><button checked="true" class="ant-switch ant-switch-checked" type="button" role="switch" aria-checked="true">
4+
<div><button class="ant-switch ant-switch-checked" type="button" role="switch" aria-checked="true">
55
<!----><span class="ant-switch-inner"><!----></span></button></div>
66
`;
77

88
exports[`renders ./antdv-demo/docs/switch/demo/disabled.md correctly 1`] = `
9-
<div><button checked="true" style="margin-bottom: 5px;" class="ant-switch ant-switch-checked ant-switch-disabled" type="button" role="switch" aria-checked="true" disabled="">
9+
<div><button style="margin-bottom: 5px;" class="ant-switch ant-switch-checked ant-switch-disabled" type="button" role="switch" aria-checked="true" disabled="">
1010
<!----><span class="ant-switch-inner"><!----></span></button><br><button class="ant-btn ant-btn-primary" type="button">
1111
<!----><span>Toggle disabled</span></button></div>
1212
`;
1313
14-
exports[`renders ./antdv-demo/docs/switch/demo/loading.md correctly 1`] = `<div><button checked="true" class="ant-switch-loading ant-switch ant-switch-checked ant-switch-disabled" type="button" role="switch" aria-checked="true" disabled=""><span role="img" aria-label="loading" class="anticon anticon-loading ant-switch-loading-icon"><svg class="anticon-spin" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span><span class="ant-switch-inner"><!----></span></button><br><button checked="false" class="ant-switch-small ant-switch-loading ant-switch ant-switch-disabled" type="button" role="switch" aria-checked="false" disabled=""><span role="img" aria-label="loading" class="anticon anticon-loading ant-switch-loading-icon"><svg class="anticon-spin" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span><span class="ant-switch-inner"><!----></span></button></div>`;
14+
exports[`renders ./antdv-demo/docs/switch/demo/loading.md correctly 1`] = `<div><button class="ant-switch-loading ant-switch ant-switch-checked ant-switch-disabled" type="button" role="switch" aria-checked="true" disabled=""><span role="img" aria-label="loading" class="anticon anticon-loading ant-switch-loading-icon"><svg class="anticon-spin" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span><span class="ant-switch-inner"><!----></span></button><br><button class="ant-switch-small ant-switch-loading ant-switch ant-switch-disabled" type="button" role="switch" aria-checked="false" disabled=""><span role="img" aria-label="loading" class="anticon anticon-loading ant-switch-loading-icon"><svg class="anticon-spin" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span><span class="ant-switch-inner"><!----></span></button></div>`;
1515
1616
exports[`renders ./antdv-demo/docs/switch/demo/size.md correctly 1`] = `
17-
<div><button checked="true" class="ant-switch ant-switch-checked" type="button" role="switch" aria-checked="true">
18-
<!----><span class="ant-switch-inner"><!----></span></button><br><button checked="true" class="ant-switch-small ant-switch ant-switch-checked" type="button" role="switch" aria-checked="true">
17+
<div><button class="ant-switch ant-switch-checked" type="button" role="switch" aria-checked="true">
18+
<!----><span class="ant-switch-inner"><!----></span></button><br><button class="ant-switch-small ant-switch ant-switch-checked" type="button" role="switch" aria-checked="true">
1919
<!----><span class="ant-switch-inner"><!----></span></button></div>
2020
`;
2121
2222
exports[`renders ./antdv-demo/docs/switch/demo/text.md correctly 1`] = `
23-
<div><button checked="true" class="ant-switch ant-switch-checked" type="button" role="switch" aria-checked="true">
24-
<!----><span class="ant-switch-inner">开</span></button><br><button checked="false" class="ant-switch" type="button" role="switch" aria-checked="false">
25-
<!----><span class="ant-switch-inner">0</span></button><br><button checked="false" class="ant-switch" type="button" role="switch" aria-checked="false">
23+
<div><button class="ant-switch ant-switch-checked" type="button" role="switch" aria-checked="true">
24+
<!----><span class="ant-switch-inner">开</span></button><br><button class="ant-switch" type="button" role="switch" aria-checked="false">
25+
<!----><span class="ant-switch-inner">0</span></button><br><button class="ant-switch" type="button" role="switch" aria-checked="false">
2626
<!----><span class="ant-switch-inner"><span role="img" aria-label="close" class="anticon anticon-close"><svg class="" data-icon="close" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896" focusable="false"><path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"></path></svg></span></span></button></div>
2727
`;

components/vc-switch/Switch.jsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { switchPropTypes } from './PropTypes';
22
import BaseMixin from '../_util/BaseMixin';
33
import { hasProp, getOptionProps, getComponent } from '../_util/props-util';
4+
import Omit from 'omit.js';
45

56
// function noop () {
67
// }
@@ -79,16 +80,7 @@ export default {
7980
},
8081
},
8182
render() {
82-
const {
83-
prefixCls,
84-
disabled,
85-
loadingIcon,
86-
defaultChecked,
87-
autofocus,
88-
checkedChildren,
89-
unCheckedChildren,
90-
...restProps
91-
} = getOptionProps(this);
83+
const { prefixCls, disabled, loadingIcon, ...restProps } = getOptionProps(this);
9284
const checked = this.stateChecked;
9385
const { $attrs } = this;
9486
const switchClassName = {
@@ -98,7 +90,13 @@ export default {
9890
[`${prefixCls}-disabled`]: disabled,
9991
};
10092
const spanProps = {
101-
...restProps,
93+
...Omit(restProps, [
94+
'checkedChildren',
95+
'unCheckedChildren',
96+
'checked',
97+
'autofocus',
98+
'defaultChecked',
99+
]),
102100
...$attrs,
103101
onKeydown: this.handleKeyDown,
104102
onClick: this.handleClick,

0 commit comments

Comments
 (0)