From 95925ab32853568d8731a9417849fcd58fd434ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Tue, 30 Apr 2019 15:11:05 +0800 Subject: [PATCH] [new feature] SwitchCell: add border prop --- docs/markdown/v2-progress-tracking.md | 4 ++++ .../test/__snapshots__/index.spec.js.snap | 2 +- packages/notice-bar/en-US.md | 2 +- packages/switch-cell/en-US.md | 7 ++++--- packages/switch-cell/index.tsx | 5 ++++- .../switch-cell/test/__snapshots__/index.spec.js.snap | 11 +++++++++++ packages/switch-cell/test/index.spec.js | 10 ++++++++++ packages/switch-cell/zh-CN.md | 1 + 8 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 packages/switch-cell/test/__snapshots__/index.spec.js.snap diff --git a/docs/markdown/v2-progress-tracking.md b/docs/markdown/v2-progress-tracking.md index 7959b9002..7d596d569 100644 --- a/docs/markdown/v2-progress-tracking.md +++ b/docs/markdown/v2-progress-tracking.md @@ -56,6 +56,10 @@ - 新增`left-icon`插槽 - 新增`right-icon`插槽 +## SwitchCell + +- 新增`border`属性 + ### Sku - 新增`preview-open`事件 diff --git a/packages/address-edit/test/__snapshots__/index.spec.js.snap b/packages/address-edit/test/__snapshots__/index.spec.js.snap index b7ec713da..ba9f8f8a7 100644 --- a/packages/address-edit/test/__snapshots__/index.spec.js.snap +++ b/packages/address-edit/test/__snapshots__/index.spec.js.snap @@ -93,7 +93,7 @@ exports[`create a AddressEdit with props 1`] = `
-
+
设为默认收货地址
diff --git a/packages/notice-bar/en-US.md b/packages/notice-bar/en-US.md index 314d29708..788f4baec 100644 --- a/packages/notice-bar/en-US.md +++ b/packages/notice-bar/en-US.md @@ -65,7 +65,7 @@ Vue.use(NoticeBar); | Event | Description | Arguments | |------|------|------| | click | Triggered when click NoticeBar | - | -| click | Triggered when closed | - | +| close | Triggered when closed | - | ### Slot diff --git a/packages/switch-cell/en-US.md b/packages/switch-cell/en-US.md index fa9f29a3b..e40c56ff6 100644 --- a/packages/switch-cell/en-US.md +++ b/packages/switch-cell/en-US.md @@ -55,9 +55,10 @@ use `loading` property to keep component in loading state | Attribute | Description | Type | Default | |------|------|------|------| | v-model | on-off state of the switch | `any` | `false` | -| title | the leftside title | `String` | `''` | -| loading | whether switch is loading | `Boolean` | `false` | -| disabled | whether to disable switch | `Boolean` | `false` | +| title | the left side title | `String` | `''` | +| border | whether to show cell border | `Boolean` | `true` | +| loading | whether switch is loading | `Boolean` | `false` | +| disabled | whether to disable switch | `Boolean` | `false` | | size | Size of switch | `String` | `24px` | | active-color | Background of switch color when active | `String` | `#1989fa` | | inactive-color | Background of switch color when inactive | `String` | `#fff` | diff --git a/packages/switch-cell/index.tsx b/packages/switch-cell/index.tsx index 26e600b51..7fbf15658 100644 --- a/packages/switch-cell/index.tsx +++ b/packages/switch-cell/index.tsx @@ -38,7 +38,10 @@ function SwitchCell( SwitchCell.props = { ...switchProps, title: String, - border: Boolean, + border: { + type: Boolean, + default: true + }, size: { type: String, default: '24px' diff --git a/packages/switch-cell/test/__snapshots__/index.spec.js.snap b/packages/switch-cell/test/__snapshots__/index.spec.js.snap new file mode 100644 index 000000000..9bcd1042d --- /dev/null +++ b/packages/switch-cell/test/__snapshots__/index.spec.js.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`border prop 1`] = ` +
+
+
+
+
+
+
+`; diff --git a/packages/switch-cell/test/index.spec.js b/packages/switch-cell/test/index.spec.js index 70dda9556..4682d09ab 100644 --- a/packages/switch-cell/test/index.spec.js +++ b/packages/switch-cell/test/index.spec.js @@ -15,3 +15,13 @@ test('change event', () => { expect(onChange).toHaveBeenCalledWith(true); }); + +test('border prop', () => { + const wrapper = mount(SwitchCell, { + propsData: { + border: false + } + }); + + expect(wrapper).toMatchSnapshot(); +}); diff --git a/packages/switch-cell/zh-CN.md b/packages/switch-cell/zh-CN.md index fedcf22af..abc0fabcb 100644 --- a/packages/switch-cell/zh-CN.md +++ b/packages/switch-cell/zh-CN.md @@ -55,6 +55,7 @@ export default { |------|------|------|------|------| | v-model | 开关状态 | `null` | `false` | - | | title | 左侧标题 | `String` | `''` | - | +| border | 是否展示单元格内边框 | `Boolean` | `true` | 2.0.0 | | loading | 是否为加载状态 | `Boolean` | `false` | - | | disabled | 是否为禁用状态 | `Boolean` | `false` | - | | size | 开关尺寸 | `String` | `24px` | 1.1.11 |