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 />', () => {
2222 } ) ;
2323 } ) ;
2424
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+
2535 describe ( 'nodes' , ( ) => {
2636 it ( 'should render the node\'s label' , ( ) => {
2737 const wrapper = shallow (
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import TreeNode from '../src/js/TreeNode';
66
77const baseProps = {
88 checked : 0 ,
9+ disabled : false ,
10+ expandDisabled : false ,
911 expanded : false ,
1012 label : 'Jupiter' ,
1113 optimisticToggle : true ,
@@ -84,6 +86,26 @@ describe('<TreeNode />', () => {
8486 } ) ;
8587 } ) ;
8688
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+
87109 describe ( 'expanded' , ( ) => {
88110 it ( 'should render children when set to true' , ( ) => {
89111 const wrapper = shallow (
You can’t perform that action at this time.
0 commit comments