From 36fd5a2e748897c0fbc3ef3dfcd21d42e43d8ea9 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Thu, 4 Feb 2016 10:40:23 +0800 Subject: [PATCH] MDL-52970 behat: For single select only click event is enough --- lib/behat/form_field/behat_form_select.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/behat/form_field/behat_form_select.php b/lib/behat/form_field/behat_form_select.php index 1c9c1f8cfb9..6bc66a83cb0 100644 --- a/lib/behat/form_field/behat_form_select.php +++ b/lib/behat/form_field/behat_form_select.php @@ -89,8 +89,15 @@ class behat_form_select extends behat_form_field { return; } } - // This is a single select, let's pass the last one specified. - $this->field->selectOption(end($options)); + + // If not running JS or not a singleselect then use selectOption. + // For singleselect only click event is enough. + if (!$this->running_javascript() || + !($this->field->hasClass('singleselect') || $this->field->hasClass('urlselect'))) { + + // This is a single select, let's pass the last one specified. + $this->field->selectOption(end($options)); + } } // With JS disabled this is enough and we finish here.