accordion tests added

pull/2305/head
Tuğçe Küçükoğlu 2022-03-10 12:16:28 +03:00 committed by Tuğçe Küçükoğlu
parent 89690bda7f
commit 6fb29063c9
2 changed files with 24 additions and 1 deletions

View File

@ -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.p-component').exists()).toBe(true);
expect(wrapper.find('.p-accordion-tab').exists()).toBe(true); expect(wrapper.find('.p-accordion-tab').exists()).toBe(true);
expect(wrapper.findAll('.p-accordion-tab').length).toBe(3); 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');
});
}); });

View File

@ -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: '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do</p>'
}
});
expect(wrapper.text()).toBe('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do');
});
});