/
Jumbotron.spec.js
37 lines (27 loc) · 1.12 KB
/
Jumbotron.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
import React from 'react';
import { shallow, mount } from 'enzyme';
import { Jumbotron } from '../';
describe('Jumbotron', () => {
it('should render children', () => {
const wrapper = shallow(<Jumbotron>Hello World</Jumbotron>);
expect(wrapper.text()).toBe('Hello World');
});
it('should render elements as children', () => {
const wrapper = mount(<Jumbotron><h1>Hello from h1</h1></Jumbotron>);
expect(wrapper.find('h1').hostNodes().length).toBe(1);
expect(wrapper.find('h1').hostNodes().text()).toBe('Hello from h1');
});
it('should have class jumbotron', () => {
const wrapper = shallow(<Jumbotron>Hello</Jumbotron>);
expect(wrapper.hasClass('jumbotron')).toBe(true);
});
it('should render fluid jumbotron', () => {
const wrapper = shallow(<Jumbotron fluid>Hello</Jumbotron>);
expect(wrapper.hasClass('jumbotron')).toBe(true);
expect(wrapper.hasClass('jumbotron-fluid')).toBe(true);
});
it('should render custom class', () => {
const wrapper = shallow(<Jumbotron className="custom-class">Hello</Jumbotron>);
expect(wrapper.hasClass('custom-class')).toBe(true);
});
});