-
Notifications
You must be signed in to change notification settings - Fork 22
/
item.spec.js
38 lines (31 loc) · 1.07 KB
/
item.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { expect } from 'chai';
import { mount } from '@vue/test-utils';
import Item from './item.vue';
describe('Item', () => {
it('should display todo item', () => {
const wrapper = mount(Item, {
props: {
todo: { id: 'e2bb892a-844a-47fb-a2b3-47f491af9d88', name: 'Demo', completed: false }
}
});
expect(wrapper.find('label').text()).to.eql('Demo');
});
it('should mark todo item as completed', () => {
const wrapper = mount(Item, {
props: {
todo: { id: 'e2bb892a-844a-47fb-a2b3-47f491af9d88', name: 'Demo', completed: true }
}
});
expect(wrapper.find('li').classes()).to.contain('completed');
});
it.skip('should notify about remove button', () => {
const wrapper = mount(Item, {
props: {
todo: { id: 'e2bb892a-844a-47fb-a2b3-47f491af9d88', name: 'Demo', completed: false }
}
});
wrapper.find('.destroy').trigger('click');
expect(wrapper.emitted().remove).to.have.lengthOf(1);
expect(wrapper.emitted().remove[0]).to.eql(['e2bb892a-844a-47fb-a2b3-47f491af9d88']);
});
});