And I expand "cat1" node
And I should see "c1" in the "Navigation" "block"
And I expand "c1" node
- Then I should not see "
- And I should see "cat1" in the "Navigation" "block"
+ Then I should see "cat1" in the "Navigation" "block"
And I should see "cat2" in the "Navigation" "block"
And I should see "cat3" in the "Navigation" "block"
And I should see "cat31" in the "Navigation" "block"
And I should see "c1" in the "Navigation" "block"
And I should not see "c2" in the "Navigation" "block"
And I should see "c31" in the "Navigation" "block"
- And I should not see "c32" in the "Navigation" "block"
\ No newline at end of file
+ And I should not see "c32" in the "Navigation" "block"
$hasblocktree = "[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]";
$hasbranch = "[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]";
$hascollapsed = "li[contains(concat(' ', normalize-space(@class), ' '), ' collapsed ') or @data-exandable='1']";
- $notcollapsed = "[not(contains(concat(' ', normalize-space(@class), ' '), ' collapsed '))]";
+ $notcollapsed = "li[not(contains(concat(' ', normalize-space(@class), ' '), ' collapsed '))]";
$match = "[normalize-space(.)={$nodetextliteral}]";
// Avoid problems with quotes.
$iscollapsed = 'li';
}
- $xpath = "//ul{$hasblocktree}//li{$notcollapsed}/ul/{$iscollapsed}/p{$isbranch}/a{$match}|";
- $xpath .= "//ul{$hasblocktree}//li{$notcollapsed}/ul/{$iscollapsed}/p{$isbranch}/span{$match}";
+ // First check root nodes.
+ $xpath = "//ul{$hasblocktree}/$hascollapsed/p{$isbranch}/span{$match}|";
+ // Next search for the node containing the text within a link.
+ $xpath .= "//ul{$hasblocktree}//{$notcollapsed}/ul/{$iscollapsed}/p{$isbranch}/a{$match}|";
+ // Finally search for the node containing the text within a span.
+ $xpath .= "//ul{$hasblocktree}//{$notcollapsed}/ul/{$iscollapsed}/p{$isbranch}/span{$match}";
$node = $this->find('xpath', $xpath, $exception);
$this->ensure_node_is_visible($node);