diff --git a/packages/vant/src/action-sheet/test/index.spec.ts b/packages/vant/src/action-sheet/test/index.spec.ts index 1eb5195bb..469de0b92 100644 --- a/packages/vant/src/action-sheet/test/index.spec.ts +++ b/packages/vant/src/action-sheet/test/index.spec.ts @@ -120,7 +120,7 @@ test('should allow to use the teleport prop', () => { expect(root.querySelector('.van-action-sheet')).toBeTruthy(); }); -test('should have "van-popup--round" class when setting the round prop', () => { +test('should have "van-popup--round" class when setting the round prop', async () => { const wrapper = mount(ActionSheet, { props: { show: true, @@ -129,6 +129,9 @@ test('should have "van-popup--round" class when setting the round prop', () => { }); expect(wrapper.find('.van-popup--round').exists()).toBeTruthy(); + + await wrapper.setProps({ round: false }); + expect(wrapper.find('.van-popup--round').exists()).toBeFalsy(); }); test('should change option color when using the color prop', () => { diff --git a/packages/vant/src/share-sheet/README.md b/packages/vant/src/share-sheet/README.md index c7558f9a8..c5eeb09ef 100644 --- a/packages/vant/src/share-sheet/README.md +++ b/packages/vant/src/share-sheet/README.md @@ -174,6 +174,7 @@ export default { | cancel-text | Cancel button text | _string_ | `'Cancel'` | | description | Description | _string_ | - | | duration | Transition duration, unit second | _number \| string_ | `0.3` | +| round `v3.2.6` | Whether to show round corner | _boolean_ | `true` | | overlay | Whether to show overlay | _boolean_ | `true` | | overlay-class | Custom overlay class | _string \| Array \| object_ | - | | overlay-style | Custom overlay style | _object_ | - | diff --git a/packages/vant/src/share-sheet/README.zh-CN.md b/packages/vant/src/share-sheet/README.zh-CN.md index 485fcb190..9bc052e68 100644 --- a/packages/vant/src/share-sheet/README.zh-CN.md +++ b/packages/vant/src/share-sheet/README.zh-CN.md @@ -186,6 +186,7 @@ export default { | cancel-text | 取消按钮文字,传入空字符串可以隐藏按钮 | _string_ | `'取消'` | | description | 标题下方的辅助描述文字 | _string_ | - | | duration | 动画时长,单位秒,设置为 0 可以禁用动画 | _number \| string_ | `0.3` | +| round `v3.2.6` | 是否显示圆角 | _boolean_ | `true` | | overlay | 是否显示遮罩层 | _boolean_ | `true` | | overlay-class | 自定义遮罩层类名 | _string \| Array \| object_ | - | | overlay-style | 自定义遮罩层样式 | _object_ | - | diff --git a/packages/vant/src/share-sheet/ShareSheet.tsx b/packages/vant/src/share-sheet/ShareSheet.tsx index 8e9f15bfe..a0b5026a1 100644 --- a/packages/vant/src/share-sheet/ShareSheet.tsx +++ b/packages/vant/src/share-sheet/ShareSheet.tsx @@ -35,6 +35,7 @@ const PRESET_ICONS = [ const popupKeys = [ ...popupSharedPropKeys, + 'round', 'closeOnPopstate', 'safeAreaInsetBottom', ] as const; @@ -53,6 +54,7 @@ export default defineComponent({ props: extend({}, popupSharedProps, { title: String, + round: truthProp, options: makeArrayProp(), cancelText: String, description: String, @@ -136,7 +138,6 @@ export default defineComponent({ return () => ( { expect(wrapper.find('.van-share-sheet__cancel').html()).toMatchSnapshot(); }); + +test('should have "van-popup--round" class when setting the round prop', async () => { + const wrapper = mount(ShareSheet, { + props: { + show: true, + round: true, + }, + }); + + expect(wrapper.find('.van-popup--round').exists()).toBeTruthy(); + + await wrapper.setProps({ round: false }); + expect(wrapper.find('.van-popup--round').exists()).toBeFalsy(); +});