blob: 1c669e61a0579eb25885db5159d859e9f608ccf6 (
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
|
import TreeNode from 'generic-components/treeNode/TreeNode';
import React from 'react';
import { mount } from 'enzyme';
describe('TreeNode', () => {
let treeNode;
beforeEach(() => {
treeNode = mount(<TreeNode node={{title: 'AAA'}}/>).instance();
});
it('Should be invisible when created', () => {
// then
expect(treeNode.state['visible']).toEqual(false)
});
it('Should be visible when toggled', () => {
// given
expect(treeNode.state['visible']).toEqual(false)
// when
treeNode.toggle();
// then
expect(treeNode.state['visible']).toEqual(true)
});
it('Should be invisible when double toggled', () => {
// given
expect(treeNode.state['visible']).toEqual(false);
// when
treeNode.toggle();
treeNode.toggle();
// then
expect(treeNode.state['visible']).toEqual(false);
});
});
|