mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-47410 behat: Use data-fieldtype attribute to guess the field type
The data-fieldtype attribute (if present) should be also utilized in guess_field_type() and match the behavior in get_field_node_type().
This commit is contained in:
parent
d46f1a3ef4
commit
896364e4c4
@ -136,6 +136,11 @@ class behat_field_manager {
|
||||
*/
|
||||
public static function guess_field_type(NodeElement $fieldnode, Session $session) {
|
||||
|
||||
// If the type is explicitly set on the element pointed to by the label - use it.
|
||||
if ($fieldtype = $fieldnode->getAttribute('data-fieldtype')) {
|
||||
return self::normalise_fieldtype($fieldtype);
|
||||
}
|
||||
|
||||
// Textareas are considered text based elements.
|
||||
$tagname = strtolower($fieldnode->getTagName());
|
||||
if ($tagname == 'textarea') {
|
||||
@ -151,10 +156,6 @@ class behat_field_manager {
|
||||
$type = $fieldnode->getAttribute('type');
|
||||
switch ($type) {
|
||||
case 'text':
|
||||
if ($fieldtype = $fieldnode->getAttribute('data-fieldtype')) {
|
||||
return self::normalise_fieldtype($fieldtype);
|
||||
}
|
||||
return 'text';
|
||||
case 'password':
|
||||
case 'email':
|
||||
case 'file':
|
||||
|
Loading…
x
Reference in New Issue
Block a user