1 | const React = require('react');
|
2 | const { expect } = require('chai');
|
3 | const { shallow } = require('enzyme');
|
4 | const { Value } = require('../');
|
5 |
|
6 | describe('<Value /> (rendering Boolean)', () => {
|
7 | context('when the value is true', () => {
|
8 | const component = shallow(<Value type="Boolean" value={true} />);
|
9 |
|
10 | it('sets the base class', () => {
|
11 | expect(component.hasClass('element-value')).to.equal(true);
|
12 | });
|
13 |
|
14 | it('sets the type class', () => {
|
15 | expect(component.hasClass('element-value-is-boolean')).to.equal(true);
|
16 | });
|
17 |
|
18 | it('sets the title', () => {
|
19 | expect(component.props().title).to.equal('true');
|
20 | });
|
21 |
|
22 | it('sets the value', () => {
|
23 | expect(component.text()).to.equal('true');
|
24 | });
|
25 | });
|
26 |
|
27 | context('when the value is false', () => {
|
28 | const component = shallow(<Value type="Boolean" value={false} />);
|
29 |
|
30 | it('sets the base class', () => {
|
31 | expect(component.hasClass('element-value')).to.equal(true);
|
32 | });
|
33 |
|
34 | it('sets the type class', () => {
|
35 | expect(component.hasClass('element-value-is-boolean')).to.equal(true);
|
36 | });
|
37 |
|
38 | it('sets the title', () => {
|
39 | expect(component.props().title).to.equal('false');
|
40 | });
|
41 |
|
42 | it('sets the value', () => {
|
43 | expect(component.text()).to.equal('false');
|
44 | });
|
45 | });
|
46 | });
|