@@ -117,7 +117,7 @@ def test_automatically_expands_all_ancestors
117117
118118 # This explicitly tests the MutationObserver in tree_view.ts that listens for expanded nodes
119119 def test_automatically_expands_all_ancestors_when_async_items_have_expanded_child
120- visit_preview ( :async_alpha , action_menu_expanded : true )
120+ visit_preview ( :async_alpha , nested_child_expanded : true )
121121
122122 activate_at_path ( "primer" )
123123 assert node_at_path ( "primer" , "alpha" , "action_menu" , "heading.rb" )
@@ -735,6 +735,15 @@ def test_single_select_works_after_async_loading
735735 assert_path ( "primer" , "alpha" )
736736 assert_path_checked ( "primer" )
737737
738+ label_and_toggle_centers = evaluate_multiline_script ( <<~JS )
739+ const node = document.querySelector(#{ selector_for ( "primer" , "alpha" ) . to_json } )
740+ const labelRect = node.querySelector('.TreeViewItemContentText').getBoundingClientRect()
741+ const toggleRect = node.parentElement.querySelector('.TreeViewItemToggle svg:not([hidden])').getBoundingClientRect()
742+
743+ return [labelRect.y + labelRect.height / 2, toggleRect.y + toggleRect.height / 2]
744+ JS
745+ assert_in_delta label_and_toggle_centers [ 0 ] , label_and_toggle_centers [ 1 ] , 0.5
746+
738747 # Expand down to the leaf nodes
739748 expand_at_path ( "primer" , "alpha" )
740749 expand_at_path ( "primer" , "alpha" , "action_menu" )
0 commit comments