diff --git a/src/contact-card/test/index.legacy.js b/src/contact-card/test/index.legacy.js deleted file mode 100644 index bc77c5561..000000000 --- a/src/contact-card/test/index.legacy.js +++ /dev/null @@ -1,33 +0,0 @@ -import ContactCard from '..'; -import { mount } from '@vue/test-utils'; - -test('should emit click event after clicking the ContactCard', () => { - const click = jest.fn(); - const wrapper = mount(ContactCard, { - context: { - on: { - click, - }, - }, - }); - - wrapper.trigger('click'); - expect(click).toHaveBeenCalledTimes(1); -}); - -test('should not emit click event after clicking the uneditable ContactCard', () => { - const click = jest.fn(); - const wrapper = mount(ContactCard, { - props: { - editable: false, - }, - context: { - on: { - click, - }, - }, - }); - - wrapper.trigger('click'); - expect(click).toHaveBeenCalledTimes(0); -}); diff --git a/src/contact-card/test/index.spec.js b/src/contact-card/test/index.spec.js new file mode 100644 index 000000000..0bd871cbf --- /dev/null +++ b/src/contact-card/test/index.spec.js @@ -0,0 +1,19 @@ +import ContactCard from '..'; +import { mount } from '@vue/test-utils'; + +test('should emit click event when clicked', () => { + const wrapper = mount(ContactCard); + wrapper.trigger('click'); + expect(wrapper.emitted('click').length).toEqual(1); +}); + +test('should not emit click event when editable is false and clicked ', () => { + const wrapper = mount(ContactCard, { + props: { + editable: false, + }, + }); + + wrapper.trigger('click'); + expect(wrapper.emitted('click')).toBeFalsy(); +});