File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,16 @@ describe('<CheckboxTree />', () => {
22
22
} ) ;
23
23
} ) ;
24
24
25
+ describe ( 'disabled' , ( ) => {
26
+ it ( 'should add the class rct-disabled to the root' , ( ) => {
27
+ const wrapper = shallow (
28
+ < CheckboxTree disabled nodes = { [ ] } /> ,
29
+ ) ;
30
+
31
+ assert . isTrue ( wrapper . find ( '.react-checkbox-tree.rct-disabled' ) . exists ( ) ) ;
32
+ } ) ;
33
+ } ) ;
34
+
25
35
describe ( 'nodes' , ( ) => {
26
36
it ( 'should render the node\'s label' , ( ) => {
27
37
const wrapper = shallow (
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import TreeNode from '../src/js/TreeNode';
6
6
7
7
const baseProps = {
8
8
checked : 0 ,
9
+ disabled : false ,
10
+ expandDisabled : false ,
9
11
expanded : false ,
10
12
label : 'Jupiter' ,
11
13
optimisticToggle : true ,
@@ -84,6 +86,26 @@ describe('<TreeNode />', () => {
84
86
} ) ;
85
87
} ) ;
86
88
89
+ describe ( 'disabled' , ( ) => {
90
+ it ( 'should disable the hidden <input> element' , ( ) => {
91
+ const wrapper = shallow (
92
+ < TreeNode { ...baseProps } disabled /> ,
93
+ ) ;
94
+
95
+ assert . isTrue ( wrapper . find ( 'input[disabled]' ) . exists ( ) ) ;
96
+ } ) ;
97
+ } ) ;
98
+
99
+ describe ( 'expandDisabled' , ( ) => {
100
+ it ( 'should disable the expand <button>' , ( ) => {
101
+ const wrapper = shallow (
102
+ < TreeNode { ...baseProps } expandDisabled rawChildren = { [ { value : 'europa' , label : 'Europa' } ] } /> ,
103
+ ) ;
104
+
105
+ assert . isTrue ( wrapper . find ( 'button.rct-collapse-btn[disabled]' ) . exists ( ) ) ;
106
+ } ) ;
107
+ } ) ;
108
+
87
109
describe ( 'expanded' , ( ) => {
88
110
it ( 'should render children when set to true' , ( ) => {
89
111
const wrapper = shallow (
You can’t perform that action at this time.
0 commit comments