File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -142,4 +142,68 @@ describe('<CheckboxTree />', () => {
142
142
assert . deepEqual ( [ 'io' , 'europa' ] , actual ) ;
143
143
} ) ;
144
144
} ) ;
145
+
146
+ describe ( 'nodeProps' , ( ) => {
147
+ describe ( 'disabled' , ( ) => {
148
+ it ( 'should disable the target node when set to true' , ( ) => {
149
+ const wrapper = shallow (
150
+ < CheckboxTree
151
+ nodes = { [
152
+ {
153
+ value : 'jupiter' ,
154
+ label : 'Jupiter' ,
155
+ disabled : true ,
156
+ children : [
157
+ { value : 'europa' , label : 'Europa' } ,
158
+ ] ,
159
+ } ,
160
+ ] }
161
+ /> ,
162
+ ) ;
163
+
164
+ assert . isTrue ( wrapper . find ( TreeNode ) . prop ( 'disabled' ) ) ;
165
+ } ) ;
166
+
167
+ it ( 'should disable the child nodes when `noCascade` is false' , ( ) => {
168
+ const wrapper = shallow (
169
+ < CheckboxTree
170
+ expanded = { [ 'jupiter' ] }
171
+ nodes = { [
172
+ {
173
+ value : 'jupiter' ,
174
+ label : 'Jupiter' ,
175
+ disabled : true ,
176
+ children : [
177
+ { value : 'europa' , label : 'Europa' } ,
178
+ ] ,
179
+ } ,
180
+ ] }
181
+ /> ,
182
+ ) ;
183
+
184
+ assert . isTrue ( wrapper . find ( 'TreeNode[value="europa"]' ) . prop ( 'disabled' ) ) ;
185
+ } ) ;
186
+
187
+ it ( 'should NOT disable the child nodes when `noCascade` is true' , ( ) => {
188
+ const wrapper = shallow (
189
+ < CheckboxTree
190
+ expanded = { [ 'jupiter' ] }
191
+ noCascade
192
+ nodes = { [
193
+ {
194
+ value : 'jupiter' ,
195
+ label : 'Jupiter' ,
196
+ disabled : true ,
197
+ children : [
198
+ { value : 'europa' , label : 'Europa' } ,
199
+ ] ,
200
+ } ,
201
+ ] }
202
+ /> ,
203
+ ) ;
204
+
205
+ assert . isFalse ( wrapper . find ( 'TreeNode[value="europa"]' ) . prop ( 'disabled' ) ) ;
206
+ } ) ;
207
+ } ) ;
208
+ } ) ;
145
209
} ) ;
You can’t perform that action at this time.
0 commit comments