From 31b7772d8563386f5ef6b369376c2574425c32e3 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Thu, 13 Aug 2020 22:19:29 +0800 Subject: [PATCH] test: update snap --- .../__tests__/__snapshots__/demo.test.js.snap | 56 ++++++++++++------- .../__tests__/__snapshots__/demo.test.js.snap | 16 +++--- components/vc-switch/Switch.jsx | 20 +++---- 3 files changed, 52 insertions(+), 40 deletions(-) diff --git a/components/spin/__tests__/__snapshots__/demo.test.js.snap b/components/spin/__tests__/__snapshots__/demo.test.js.snap index 9880a9643..6cc6da1ed 100644 --- a/components/spin/__tests__/__snapshots__/demo.test.js.snap +++ b/components/spin/__tests__/__snapshots__/demo.test.js.snap @@ -2,55 +2,71 @@ exports[`renders ./antdv-demo/docs/spin/demo/basic.md correctly 1`] = `
-
+
+ +
`; exports[`renders ./antdv-demo/docs/spin/demo/custom-indicator.md correctly 1`] = `
-
-
+
+
+
+ +
+
+
+
+
+ +
`; exports[`renders ./antdv-demo/docs/spin/demo/delayAndDebounce.md correctly 1`] = `
+
-
- 可以点击‘切换’按钮,延迟显示 loading 效果。当 spinning 状态在 \`delay\` 时间内结束,则不显示 - loading 状态。 -
+
可以点击‘切换’按钮,延迟显示 loading 效果。当 spinning 状态在 \`delay\` 时间内结束,则不显示 loading 状态。
-
- Loading state: +
Loading state: `; exports[`renders ./antdv-demo/docs/spin/demo/inside.md correctly 1`] = `
-
+
+ +
`; exports[`renders ./antdv-demo/docs/spin/demo/nested.md correctly 1`] = `
+
-
- 可以点击‘切换’按钮,控制本区域的spin展示。 -
+
可以点击‘切换’按钮,控制本区域的spin展示。
-
- Loading state: +
Loading state: `; exports[`renders ./antdv-demo/docs/spin/demo/size.md correctly 1`] = `
-
-
-
+
+ +
+
+ +
+
+ +
`; @@ -63,9 +79,7 @@ exports[`renders ./antdv-demo/docs/spin/demo/tip.md correctly 1`] = `
-
- 我的描述文案是自定义的。。。 -
+
我的描述文案是自定义的。。。
diff --git a/components/switch/__tests__/__snapshots__/demo.test.js.snap b/components/switch/__tests__/__snapshots__/demo.test.js.snap index 1262f2688..cba3ccdfc 100644 --- a/components/switch/__tests__/__snapshots__/demo.test.js.snap +++ b/components/switch/__tests__/__snapshots__/demo.test.js.snap @@ -1,27 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders ./antdv-demo/docs/switch/demo/basic.md correctly 1`] = ` -
`; exports[`renders ./antdv-demo/docs/switch/demo/disabled.md correctly 1`] = ` -

`; -exports[`renders ./antdv-demo/docs/switch/demo/loading.md correctly 1`] = `

`; +exports[`renders ./antdv-demo/docs/switch/demo/loading.md correctly 1`] = `

`; exports[`renders ./antdv-demo/docs/switch/demo/size.md correctly 1`] = ` -


`; exports[`renders ./antdv-demo/docs/switch/demo/text.md correctly 1`] = ` -




`; diff --git a/components/vc-switch/Switch.jsx b/components/vc-switch/Switch.jsx index ae0147ef5..7f087e197 100644 --- a/components/vc-switch/Switch.jsx +++ b/components/vc-switch/Switch.jsx @@ -1,6 +1,7 @@ import { switchPropTypes } from './PropTypes'; import BaseMixin from '../_util/BaseMixin'; import { hasProp, getOptionProps, getComponent } from '../_util/props-util'; +import Omit from 'omit.js'; // function noop () { // } @@ -79,16 +80,7 @@ export default { }, }, render() { - const { - prefixCls, - disabled, - loadingIcon, - defaultChecked, - autofocus, - checkedChildren, - unCheckedChildren, - ...restProps - } = getOptionProps(this); + const { prefixCls, disabled, loadingIcon, ...restProps } = getOptionProps(this); const checked = this.stateChecked; const { $attrs } = this; const switchClassName = { @@ -98,7 +90,13 @@ export default { [`${prefixCls}-disabled`]: disabled, }; const spanProps = { - ...restProps, + ...Omit(restProps, [ + 'checkedChildren', + 'unCheckedChildren', + 'checked', + 'autofocus', + 'defaultChecked', + ]), ...$attrs, onKeydown: this.handleKeyDown, onClick: this.handleClick,