Skip to content

Commit

Permalink
Merge branch '44711-26-r2' of git://github.com/samhemelryk/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_26_STABLE
  • Loading branch information
danpoltawski committed May 20, 2014
2 parents e679a37 + 4fc9f74 commit 239db05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions blocks/navigation/tests/behat/view_my_courses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ Feature: View my courses in navigation block
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"
Expand Down
10 changes: 7 additions & 3 deletions lib/tests/behat/behat_navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function get_node_text_node($text, $branch = false, $collapsed = null,
$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.
Expand All @@ -77,8 +77,12 @@ protected function get_node_text_node($text, $branch = false, $collapsed = null,
$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);
Expand Down

0 comments on commit 239db05

Please sign in to comment.