-
Bug
-
Resolution: Fixed
-
Minor
-
4.0.3
-
MOODLE_400_STABLE
-
MOODLE_400_STABLE
-
MDL-75608-master -
The 'I expand all fieldsets' step (function expand_all_fields in behat_forms.php) has 2 different cases:
1) If there is an 'Expand all' link, it clicks it.
2) If there is no 'Expand all' link, but there is a fieldset that needs expanding, it clicks that instead.
Part 1 works, but Part 2 does not work any more because the HTML has changed. In core this does not cause a problem because the 'Expand all' link always appears if there is more than one fieldset, and if there is only one fieldset then it normally defaults to expanded so nobody would be using this step anyway.
However, in some of our plugins we have forms which have a 'first section' without a heading (always visible) and a second fieldset with a heading which defaults to collapsed. E.g. a search form with a search box straight away, then an 'Advanced search' fieldset wwith more options. We have been using this step, and it used to work, but now (Moodle 4) it fails.
This is the problem code:
// Else, look for the first expand fieldset link.
|
$expandonlysection = "//legend[@class='ftoggler']" .
|
"//a[contains(concat(' ', @class, ' '), ' icons-collapse-expand ') and @aria-expanded = 'false']";
|
Here is the current HTML from Boost theme (grabbed from a real page):
<legend class="d-flex align-items-center" id="yui_3_17_2_1_1661849701443_46">
|
<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1" id="yui_3_17_2_1_1661849701443_45">
|
<a data-toggle="collapse" href="#id_settingsheadercontainer" role="button" aria-expanded="false" aria-controls="id_settingsheadercontainer" class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader collapsed" id="yui_3_17_2_1_1661849701443_44">
|
As you can see, the legend doesn't have class 'ftoggler', it's now moved to a div inside it.