blob: f739ed9ab0f9cd8956154c7fbbadc21eabb5f85e (
plain)
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
|
// @flow
import { expect } from 'chai';
import React from 'react';
import ReactTestUtils, { Simulate } from 'react-dom/test-utils';
import HeaderBar from '../../app/components/HeaderBar';
describe('components/HeaderBar', () => {
it('should display headerbar', () => {
const component = ReactTestUtils.renderIntoDocument(
<HeaderBar hidden={ false } />
);
ReactTestUtils.findRenderedDOMComponentWithClass(component, 'headerbar__container');
});
it('should not display headerbar', () => {
const component = ReactTestUtils.renderIntoDocument(
<HeaderBar hidden={ true } />
);
const domNodes = ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'headerbar__container');
expect(domNodes.length).to.be.equal(0);
});
it('should display settings button', () => {
const component = ReactTestUtils.renderIntoDocument(
<HeaderBar showSettings={ true } />
);
ReactTestUtils.findRenderedDOMComponentWithClass(component, 'headerbar__settings');
});
it('should not display settings button', () => {
const component = ReactTestUtils.renderIntoDocument(
<HeaderBar showSettings={ false } />
);
const domNodes = ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'headerbar__settings');
expect(domNodes.length).to.be.equal(0);
});
it('should call settings callback', (done) => {
const component = ReactTestUtils.renderIntoDocument(
<HeaderBar showSettings={ true } onSettings={ () => done() } />
);
const domNode = ReactTestUtils.findRenderedDOMComponentWithClass(component, 'headerbar__settings');
Simulate.click(domNode);
});
});
|