diff --git a/src/components/accordion/Accordion.spec.js b/src/components/accordion/Accordion.spec.js index 865329f55..cc5ecac18 100644 --- a/src/components/accordion/Accordion.spec.js +++ b/src/components/accordion/Accordion.spec.js @@ -33,9 +33,18 @@ describe('Accordion.vue', () => { }); }); - it('should Accordion and AccordionTab component exist', () => {console.log(wrapper.html()) + it('should Accordion and AccordionTab component exist', () => { expect(wrapper.find('.p-accordion.p-component').exists()).toBe(true); expect(wrapper.find('.p-accordion-tab').exists()).toBe(true); expect(wrapper.findAll('.p-accordion-tab').length).toBe(3); }); + + it('should activeIndex change', async() => { + await wrapper.setProps({ activeIndex: 1 }); + + const allTabs = wrapper.findAll('.p-accordion-tab'); + + expect(allTabs[0].classes()).not.toContain('p-accordion-tab-active'); + expect(allTabs[1].classes()).toContain('p-accordion-tab-active'); + }); }); \ No newline at end of file diff --git a/src/components/accordiontab/AccordionTab.spec.js b/src/components/accordiontab/AccordionTab.spec.js new file mode 100644 index 000000000..65f46426e --- /dev/null +++ b/src/components/accordiontab/AccordionTab.spec.js @@ -0,0 +1,14 @@ +import { mount } from '@vue/test-utils'; +import AccordionTab from '@/components/accordiontab/AccordionTab.vue'; + +describe('AccordionTab.vue', () => { + it('should exists', () => { + const wrapper = mount(AccordionTab, { + slots: { + default: '
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
' + } + }); + + expect(wrapper.text()).toBe('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do'); + }); +}); \ No newline at end of file