File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import { shallow } from 'enzyme' ;
3
+ import { assert } from 'chai' ;
4
+
5
+ import TreeNode from '../src/js/TreeNode' ;
6
+
7
+ describe ( '<TreeNode />' , ( ) => {
8
+ describe ( 'component' , ( ) => {
9
+ it ( 'should render the rct-node container' , ( ) => {
10
+ const wrapper = shallow (
11
+ < TreeNode
12
+ checked = { 0 }
13
+ expanded = { false }
14
+ label = "Europa"
15
+ optimisticToggle
16
+ treeId = "id"
17
+ value = "europa"
18
+ onCheck = { ( ) => { } }
19
+ onExpand = { ( ) => { } }
20
+ /> ,
21
+ ) ;
22
+
23
+ assert . isTrue ( wrapper . find ( '.rct-node' ) . exists ( ) ) ;
24
+ } ) ;
25
+ } ) ;
26
+
27
+ describe ( 'label' , ( ) => {
28
+ it ( 'should render the node\'s label' , ( ) => {
29
+ const wrapper = shallow (
30
+ < TreeNode
31
+ checked = { 0 }
32
+ expanded = { false }
33
+ label = "Europa"
34
+ optimisticToggle
35
+ treeId = "id"
36
+ value = "europa"
37
+ onCheck = { ( ) => { } }
38
+ onExpand = { ( ) => { } }
39
+ /> ,
40
+ ) ;
41
+
42
+ assert . isTrue ( wrapper . contains (
43
+ < span className = "rct-title" > Europa</ span > ,
44
+ ) ) ;
45
+ } ) ;
46
+ } ) ;
47
+ } ) ;
You can’t perform that action at this time.
0 commit comments