feat(Badge): offset prop support custom unit

This commit is contained in:
chenjiahan
2021-04-14 09:35:08 +08:00
committed by neverland
parent 2be579975a
commit 35edb72b5c
4 changed files with 24 additions and 8 deletions
+16
View File
@@ -57,6 +57,22 @@ test('should change dot position when using offset prop', () => {
expect(badge.style.right).toEqual('-2px');
});
test('should change dot position when using offset prop with custom unit', () => {
const wrapper = mount(Badge, {
props: {
dot: true,
offset: ['2rem', '4em'],
},
slots: {
default: () => 'Child',
},
});
const badge = wrapper.find('.van-badge');
expect(badge.style.top).toEqual('4em');
expect(badge.style.right).toEqual('-2rem');
});
test('should change dot position when using offset prop without children', () => {
const wrapper = mount(Badge, {
props: {