artianO_O
4 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
24 additions and
2 deletions
-
packages/effects/common-ui/src/components/icon-picker/__tests__/icon-picker.test.ts
-
packages/effects/common-ui/src/components/icon-picker/icon-picker.vue
|
|
|
@ -173,4 +173,27 @@ describe('icon-picker.vue', () => { |
|
|
|
|
|
|
|
wrapper.unmount(); |
|
|
|
}); |
|
|
|
|
|
|
|
it('updates the configured model value when selecting an icon', async () => { |
|
|
|
const onUpdateValue = vi.fn(); |
|
|
|
const wrapper = mount(IconPicker, { |
|
|
|
attachTo: document.body, |
|
|
|
props: { |
|
|
|
icons: STATIC_ICONS, |
|
|
|
inputComponent: markRaw(AntdvNextLikeInput), |
|
|
|
modelValueProp: 'value', |
|
|
|
prefix: '', |
|
|
|
'onUpdate:value': onUpdateValue, |
|
|
|
}, |
|
|
|
}); |
|
|
|
await openIconPicker(wrapper); |
|
|
|
|
|
|
|
const firstIcon = document.body.querySelector('.grid-cols-6 > button'); |
|
|
|
expect(firstIcon).toBeTruthy(); |
|
|
|
await new DOMWrapper(firstIcon as Element).trigger('click'); |
|
|
|
|
|
|
|
expect(onUpdateValue).toHaveBeenCalledWith('home'); |
|
|
|
|
|
|
|
wrapper.unmount(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
@ -111,8 +111,7 @@ watch( |
|
|
|
); |
|
|
|
|
|
|
|
const handleClick = (icon: string) => { |
|
|
|
currentSelect.value = icon; |
|
|
|
modelValue.value = icon; |
|
|
|
updateCurrentSelect(icon); |
|
|
|
close(); |
|
|
|
}; |
|
|
|
|
|
|
|
|