@@ -75,6 +75,45 @@ describe('<ListItem />', () => {
7575 assert . strictEqual ( wrapper . find ( `.${ testClass } ` ) . length , 1 , 'should have a div with the test class' ) ;
7676 } ) ;
7777
78+ describe ( 'props: primaryTogglesNestedList' , ( ) => {
79+ it ( 'should toggle nested list when true' , ( ) => {
80+ const wrapper = shallowWithContext (
81+ < ListItem
82+ leftCheckbox = { < div /> }
83+ primaryText = "Item text"
84+ primaryTogglesNestedList = { true }
85+ nestedItems = { [
86+ < ListItem key = { 1 } primaryText = "Nested item text" /> ,
87+ ] }
88+ />
89+ ) ;
90+ const primaryTextButton = wrapper . find ( 'EnhancedButton' ) ;
91+
92+ assert . strictEqual ( wrapper . find ( NestedList ) . props ( ) . open , false ) ;
93+
94+ primaryTextButton . simulate ( 'touchTap' , { stopPropagation : ( ) => { } } ) ;
95+ assert . strictEqual ( wrapper . find ( NestedList ) . props ( ) . open , true ) ;
96+
97+ primaryTextButton . simulate ( 'touchTap' , { stopPropagation : ( ) => { } } ) ;
98+ assert . strictEqual ( wrapper . find ( NestedList ) . props ( ) . open , false ) ;
99+ } ) ;
100+
101+ it ( 'should not render primary text button when false' , ( ) => {
102+ const wrapper = shallowWithContext (
103+ < ListItem
104+ leftCheckbox = { < div /> }
105+ primaryText = "Item text"
106+ primaryTogglesNestedList = { false }
107+ nestedItems = { [
108+ < ListItem key = { 1 } primaryText = "Nested item text" /> ,
109+ ] }
110+ />
111+ ) ;
112+
113+ assert . strictEqual ( wrapper . filter ( 'EnhancedButton' ) . length , 0 ) ;
114+ } ) ;
115+ } ) ;
116+
78117 describe ( 'props: open' , ( ) => {
79118 it ( 'should initially open nested list' , ( ) => {
80119 const wrapper = shallowWithContext (
0 commit comments