MDL-55071 behat: Normalise space on multi-field admin elements

This commit is contained in:
Frédéric Massart 2016-09-27 15:59:48 +02:00
parent adbe0fcb70
commit b3d0a8b4a7
2 changed files with 5 additions and 3 deletions

View File

@ -39,7 +39,7 @@
}}
<div class="form-group">
{{#selects}}
<select id="{{id}}{{key}}" name="{{name}}[]">
<select id="{{id}}{{key}}" name="{{name}}[]" class="form-select">
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}

View File

@ -89,8 +89,10 @@ class behat_admin extends behat_base {
} catch (ElementNotFoundException $e) {
// Multi element settings, interacting only the first one.
$fieldxpath = "//*[label[.= $label]|span[.= $label]]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
"/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
$fieldxpath = "//*[label[normalize-space(.)= $label]|span[normalize-space(.)= $label]]/" .
"ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
"/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select]" .
"[not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
$fieldnode = $this->find('xpath', $fieldxpath);
// It is the same one that contains the type.