/
Header.spec.js
55 lines (45 loc) · 1.78 KB
/
Header.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { shallow } from '@vue/test-utils';
import { testClassFromProps } from 'test/utils';
import Header from 'src/elements/Header/Header';
describe('Header', () => {
testClassFromProps(Header, [
'ui', 'header',
]);
it('should create a SUI Header', () => {
const header = shallow(Header);
expect(header.is('div')).to.equal(true);
expect(header.classes()).to.include('ui');
expect(header.classes()).to.include('header');
});
it('should have a color', () => {
const header = shallow(Header, { propsData: { color: 'red' } });
expect(header.classes()).to.include('red');
});
it('should have a size', () => {
const header = shallow(Header, { propsData: { size: '12' } });
expect(header.classes()).to.include('12');
});
it('should have a icon class', () => {
const header = shallow(Header, { propsData: { icon: true } });
expect(header.classes()).to.include('icon');
});
it('should have a floated class', () => {
const header = shallow(Header, { propsData: { floated: 'left' } });
expect(header.classes()).to.include('floated');
expect(header.classes()).to.include('left');
});
it('should have an image class', () => {
const header = shallow(Header, { propsData: { image: true } });
expect(header.classes()).to.include('image');
});
it('should have a sub class', () => {
const header = shallow(Header, { propsData: { sub: true } });
expect(header.classes()).to.include('sub');
});
it('should have content', () => {
const header1 = shallow(Header, { propsData: { content: 'Content String' } });
expect(header1.text()).to.equal('Content String');
const header2 = shallow(Header, { slots: { default: '<span>Content String</span>' } });
expect(header2.text()).to.equal('Content String');
});
});