@@ -80,6 +80,10 @@ def test_checking_parent_when_sub_items_not_included_does_not_check_children
8080 refute_path_checked ( "Students" , "Gryffindor" , "Harry Potter" )
8181 refute_path_checked ( "Students" , "Gryffindor" , "Ronald Weasley" )
8282 refute_path_checked ( "Students" , "Gryffindor" , "Hermione Granger" )
83+
84+ assert_path_enabled ( "Students" , "Gryffindor" , "Harry Potter" )
85+ assert_path_enabled ( "Students" , "Gryffindor" , "Ronald Weasley" )
86+ assert_path_enabled ( "Students" , "Gryffindor" , "Hermione Granger" )
8387 end
8488
8589 def test_checking_parent_when_sub_items_included_checks_children
@@ -93,6 +97,55 @@ def test_checking_parent_when_sub_items_included_checks_children
9397 assert_path_checked ( "Students" , "Gryffindor" , "Harry Potter" )
9498 assert_path_checked ( "Students" , "Gryffindor" , "Ronald Weasley" )
9599 assert_path_checked ( "Students" , "Gryffindor" , "Hermione Granger" )
100+
101+ refute_path_enabled ( "Students" , "Gryffindor" , "Harry Potter" )
102+ refute_path_enabled ( "Students" , "Gryffindor" , "Ronald Weasley" )
103+ refute_path_enabled ( "Students" , "Gryffindor" , "Hermione Granger" )
104+ end
105+
106+ def remember_selection_state_when_toggling_sub_items_included
107+ visit_preview ( :default )
108+
109+ check_at_path ( "Students" , "Gryffindor" , "Harry Potter" )
110+ assert_path_checked ( "Students" , "Gryffindor" , "Harry Potter" )
111+ refute_path_checked ( "Students" , "Gryffindor" )
112+ refute_path_checked ( "Students" , "Gryffindor" , "Hermione Granger" )
113+ refute_path_checked ( "Students" , "Gryffindor" , "Ronald Weasley" )
114+
115+ check "Include sub-items"
116+ assert_checked_field "Include sub-items"
117+
118+ check_at_path ( "Students" , "Gryffindor" )
119+
120+ assert_path_checked ( "Students" , "Gryffindor" , "Harry Potter" )
121+ assert_path_checked ( "Students" , "Gryffindor" , "Ronald Weasley" )
122+ assert_path_checked ( "Students" , "Gryffindor" , "Hermione Granger" )
123+
124+ check "Include sub-items"
125+ assert_unchecked_field "Include sub-items"
126+
127+ # Remember what was selected before
128+ assert_path_checked ( "Students" , "Gryffindor" , "Harry Potter" )
129+ refute_path_checked ( "Students" , "Gryffindor" )
130+ refute_path_checked ( "Students" , "Gryffindor" , "Hermione Granger" )
131+ refute_path_checked ( "Students" , "Gryffindor" , "Ronald Weasley" )
132+ end
133+
134+ def test_checking_parent_with_sub_items_included_when_children_filtered_out
135+ visit_preview ( :default )
136+
137+ check "Include sub-items"
138+ assert_checked_field "Include sub-items"
139+
140+ fill_in "Filter" , with : "Ravenclaw"
141+
142+ check_at_path ( "Students" , "Ravenclaw" )
143+ assert_path_checked ( "Students" , "Ravenclaw" )
144+
145+ find ( ".FormControl button[aria-label='Clear']" ) . click
146+
147+ assert_path_checked ( "Students" , "Ravenclaw" )
148+ assert_path_checked ( "Students" , "Ravenclaw" , "Luna Lovegood" )
96149 end
97150
98151 def test_hides_nodes_that_do_not_match_filter_text
0 commit comments