MDL-45165 behat: Adding text selector

Same behaviour than I should see step,
it looks for the text in the node + descendants,
but, to get the lower level match discards the
nodes with children that also contains the
same text.
This commit is contained in:
David Monllao 2014-04-15 20:13:44 +07:00
parent 6dac47a69c
commit 689451731c

View file

@ -70,6 +70,7 @@ class behat_selectors {
'table' => 'table', 'table' => 'table',
'field' => 'field', 'field' => 'field',
'fieldset' => 'fieldset', 'fieldset' => 'fieldset',
'text' => 'text',
'css_element' => 'css_element', 'css_element' => 'css_element',
'xpath_element' => 'xpath_element' 'xpath_element' => 'xpath_element'
); );
@ -83,7 +84,10 @@ class behat_selectors {
* @var XPaths for moodle elements. * @var XPaths for moodle elements.
*/ */
protected static $moodleselectors = array( protected static $moodleselectors = array(
'dialogue' => <<<XPATH 'text' => <<<XPATH
//*[contains(., %locator%)][count(./descendant::*[contains(., %locator%)]) = 0]
XPATH
, 'dialogue' => <<<XPATH
//div[contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue ') and //div[contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue ') and
normalize-space(descendant::div[ normalize-space(descendant::div[
contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue-hd ') contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue-hd ')