fix integration tests and paths for client tests

This commit is contained in:
Matteo Pagliazzi
2019-10-03 17:40:38 +02:00
parent d19b3857ee
commit 2a4e103812
37 changed files with 50 additions and 126 deletions

View File

@@ -0,0 +1,54 @@
import { mount } from '@vue/test-utils';
import SidebarSection from '@/components/sidebarSection.vue';
describe('Sidebar Section', () => {
let wrapper;
beforeEach(function () {
wrapper = mount(SidebarSection, {
propsData: {
title: 'Hello World',
},
slots: {
default: '<p>This is a test.</p>',
},
});
});
it('displays title', () => {
expect(wrapper.find('h3').text()).to.eq('Hello World');
});
it('displays contents', () => {
expect(wrapper.find('.section-body').find('p').text()).to.eq('This is a test.');
});
it('displays tooltip icon', () => {
expect(wrapper.contains('.section-info')).to.eq(false);
wrapper.setProps({tooltip: 'This is a test'});
expect(wrapper.contains('.section-info')).to.eq(true);
});
it('hides contents', () => {
expect(wrapper.find('.section-body').element.style.display).to.not.eq('none');
wrapper.find('.section-toggle').trigger('click');
expect(wrapper.find('.section-body').element.style.display).to.eq('none');
wrapper.find('.section-toggle').trigger('click');
expect(wrapper.find('.section-body').element.style.display).to.not.eq('none');
});
it('can hide contents by default', () => {
wrapper = mount(SidebarSection, {
propsData: {
title: 'Hello World',
show: false,
},
slots: {
default: '<p>This is a test.</p>',
},
});
expect(wrapper.find('.section-body').element.style.display).to.eq('none');
});
});