Add event listeners to vue component, fix #400
This commit is contained in:
@@ -52,6 +52,7 @@ export default (iconName, iconNode) => ({
|
||||
'stroke-width': strokeWidth,
|
||||
...data.attrs,
|
||||
},
|
||||
on: data?.on || {}
|
||||
},
|
||||
iconNode.map(([tag, attrs]) => createElement(tag, { attrs })),
|
||||
);
|
||||
|
||||
@@ -41,4 +41,16 @@ describe('Using lucide icon components', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
expect(wrapper.attributes('style')).toContain('position: absolute')
|
||||
});
|
||||
|
||||
it('should call the onClick event', () => {
|
||||
const onClick = jest.fn()
|
||||
const wrapper = mount(Smile, {
|
||||
listeners: {
|
||||
click: onClick
|
||||
}
|
||||
})
|
||||
|
||||
wrapper.trigger('click')
|
||||
expect(onClick).toHaveBeenCalled()
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user