feat(Badge): add show-zero prop (#8381)

This commit is contained in:
neverland
2021-03-19 09:59:51 +08:00
committed by GitHub
parent 2c1f412f8e
commit fa5c8cd0b4
4 changed files with 26 additions and 2 deletions
+13
View File
@@ -69,3 +69,16 @@ test('should change dot position when using offset prop without children', () =>
expect(badge.style.marginTop).toEqual('4px');
expect(badge.style.marginLeft).toEqual('2px');
});
test('should not render zero when show-zero is false', async () => {
const wrapper = mount(Badge, {
props: {
content: 0,
},
});
expect(wrapper.find('.van-badge').exists()).toBeTruthy();
await wrapper.setProps({ showZero: false });
expect(wrapper.find('.van-badge').exists()).toBeFalsy();
});