From 3feb8af8fe8bfb10cdfce6729128f2383ed7dca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Thu, 10 Mar 2022 13:20:37 +0300 Subject: [PATCH] Chip test added --- src/components/chip/Chip.spec.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/components/chip/Chip.spec.js diff --git a/src/components/chip/Chip.spec.js b/src/components/chip/Chip.spec.js new file mode 100644 index 000000000..751bd284a --- /dev/null +++ b/src/components/chip/Chip.spec.js @@ -0,0 +1,29 @@ +import { mount } from '@vue/test-utils'; +import Chip from './Chip.vue'; + +describe('Chip.vue', () => { + let wrapper; + + beforeEach(() => { + wrapper = mount(Chip, { + props: { + label: 'PrimeVue', + icon: 'pi pi-primevue', + removable: true + } + }); + }); + + it('should exists', () => { + expect(wrapper.find('.p-chip.p-component').exists()).toBe(true); + expect(wrapper.find('.p-chip-icon').classes()).toContain('pi-primevue'); + expect(wrapper.find('.p-chip-text').text()).toBe('PrimeVue'); + expect(wrapper.find('.p-chip-remove-icon').exists()).toBe(true); + }); + + it('should close icon work', async () => { + await wrapper.find('.p-chip-remove-icon').trigger('click') + + expect(wrapper.find('.p-chip.p-component').exists()).toBe(false); + }); +}); \ No newline at end of file