MDL-83563 form: Fix hideIf and disabledIf dependent on multiselects

This commit is contained in:
Lars Bonczek
2025-03-11 12:19:10 +01:00
parent 8cb5d000a1
commit 0b917eeac4
10 changed files with 298 additions and 37 deletions
+1 -1
View File
@@ -4,6 +4,6 @@
* @copyright 2018 Davo Smith, Synergy Learning
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("core/showhidesettings",["jquery"],(function($){var dependencies;function isCheckboxHiddenElement($el){return $el.is("input[type=hidden]")&&$el.siblings('input[type=checkbox][name="'+$el.attr("name")+'"]').length}function isCheckedRelevant($el,value){return!isCheckboxHiddenElement($el)&&!function($el,value){return $el.is("input[type=radio]")&&$el.attr("value")!==value}($el,value)}function isUncheckedRadioButton($el){return $el.is("input[type=radio]")&&!$el.prop("checked")}function isUncheckedCheckbox($el){return $el.is("input[type=checkbox]")&&!$el.prop("checked")}function isMultiSelect($el){return $el.is("select")&&$el.prop("multiple")}function multiSelectMatches($el,values){var selected=$el.val()||[];if(!values.length)return!1;if(selected.length!==values.length)return!1;for(var i in selected)if(selected.hasOwnProperty(i)&&-1===values.indexOf(selected[i]))return!1;return!0}var depFns={notchecked:function($dependon,value){var hide=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);isCheckedRelevant($el,value)&&(hide=hide||!$el.prop("checked"))})),hide},checked:function($dependon,value){var hide=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);isCheckedRelevant($el,value)&&(hide=hide||$el.prop("checked"))})),hide},noitemselected:function($dependon){var hide=!1;return $dependon.each((function(idx,el){var $el=$(el);hide=hide||-1===$el.prop("selectedIndex")})),hide},eq:function($dependon,value){var hide=!1,hiddenVal=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);if(!isUncheckedRadioButton($el))if(isCheckboxHiddenElement($el))hiddenVal=$el.val()===value;else if(isUncheckedCheckbox($el))hide=hide||hiddenVal;else if(isMultiSelect($el)){var values=value.split("|");hide=multiSelectMatches($el,values)}else hide=hide||$el.val()===value})),hide},in:function($dependon,value){var hide=!1,hiddenVal=!1,values=value.split("|");return $dependon.each((function(idx,el){var $el=$(el);isUncheckedRadioButton($el)||(isCheckboxHiddenElement($el)?hiddenVal=values.indexOf($el.val())>-1:hide=isUncheckedCheckbox($el)?hide||hiddenVal:isMultiSelect($el)?multiSelectMatches($el,values):hide||values.indexOf($el.val())>-1)})),hide},defaultCondition:function($dependon,value){var hide=!1,hiddenVal=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);if(!isUncheckedRadioButton($el))if(isCheckboxHiddenElement($el))hiddenVal=$el.val()!==value;else if(isUncheckedCheckbox($el))hide=hide||hiddenVal;else if(isMultiSelect($el)){var values=value.split("|");hide=!multiSelectMatches($el,values)}else hide=hide||$el.val()!==value})),hide}};function getElementsByName(name){return $('[name="'+name+'"],[name^="'+name+'["]')}function updateDependencies(){var toHide={};$.each(dependencies,(function(dependonname){var dependon=getElementsByName(dependonname);$.each(dependencies[dependonname],(function(condition,values){$.each(values,(function(value,elements){var hide=function($dependon,condition,value){return"function"==typeof depFns[condition]?depFns[condition]($dependon,value):depFns.defaultCondition($dependon,value)}(dependon,condition,value);$.each(elements,(function(idx,elToHide){toHide.hasOwnProperty(elToHide)?toHide[elToHide]=toHide[elToHide]||hide:toHide[elToHide]=hide}))}))}))})),$.each(toHide,(function(elToHide,hide){getElementsByName(elToHide).each((function(idx,el){var $parent=$(el).closest(".form-item");$parent.length&&(hide?$parent.hide():$parent.show())}))}))}return{init:function(opts){dependencies=opts.dependencies,$.each(dependencies,(function(depname){var $el=getElementsByName(depname);$el.length&&$el.on("change",updateDependencies)})),updateDependencies(),$(".form-dependenton").hide()}}}));
define("core/showhidesettings",["jquery"],(function($){var dependencies;function isCheckboxHiddenElement($el){return $el.is("input[type=hidden]")&&$el.siblings('input[type=checkbox][name="'+$el.attr("name")+'"]').length}function isCheckedRelevant($el,value){return!isCheckboxHiddenElement($el)&&!function($el,value){return $el.is("input[type=radio]")&&$el.attr("value")!==value}($el,value)}function isUncheckedRadioButton($el){return $el.is("input[type=radio]")&&!$el.prop("checked")}function isUncheckedCheckbox($el){return $el.is("input[type=checkbox]")&&!$el.prop("checked")}function isMultiSelect($el){return $el.is("select")&&$el.prop("multiple")}function multiSelectMatches($el,values){var selected=$el.val()||[];if(1===values.length&&""===values[0])return 0===selected.length;if(selected.length!==values.length)return!1;for(var i in selected)if(selected.hasOwnProperty(i)&&-1===values.indexOf(selected[i]))return!1;return!0}var depFns={notchecked:function($dependon,value){var hide=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);isCheckedRelevant($el,value)&&(hide=hide||!$el.prop("checked"))})),hide},checked:function($dependon,value){var hide=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);isCheckedRelevant($el,value)&&(hide=hide||$el.prop("checked"))})),hide},noitemselected:function($dependon){var hide=!1;return $dependon.each((function(idx,el){var $el=$(el);hide=hide||-1===$el.prop("selectedIndex")})),hide},eq:function($dependon,value){var hide=!1,hiddenVal=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);if(!isUncheckedRadioButton($el))if(isCheckboxHiddenElement($el))hiddenVal=$el.val()===value;else if(isUncheckedCheckbox($el))hide=hide||hiddenVal;else if(isMultiSelect($el)){var values=value.split("|");hide=multiSelectMatches($el,values)}else hide=hide||$el.val()===value})),hide},in:function($dependon,value){var hide=!1,hiddenVal=!1,values=value.split("|");return $dependon.each((function(idx,el){var $el=$(el);isUncheckedRadioButton($el)||(isCheckboxHiddenElement($el)?hiddenVal=values.indexOf($el.val())>-1:hide=isUncheckedCheckbox($el)?hide||hiddenVal:isMultiSelect($el)?multiSelectMatches($el,values):hide||values.indexOf($el.val())>-1)})),hide},defaultCondition:function($dependon,value){var hide=!1,hiddenVal=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);if(!isUncheckedRadioButton($el))if(isCheckboxHiddenElement($el))hiddenVal=$el.val()!==value;else if(isUncheckedCheckbox($el))hide=hide||hiddenVal;else if(isMultiSelect($el)){var values=value.split("|");hide=!multiSelectMatches($el,values)}else hide=hide||$el.val()!==value})),hide}};function getElementsByName(name){return $('[name="'+name+'"],[name^="'+name+'["]')}function updateDependencies(){var toHide={};$.each(dependencies,(function(dependonname){var dependon=getElementsByName(dependonname);$.each(dependencies[dependonname],(function(condition,values){$.each(values,(function(value,elements){var hide=function($dependon,condition,value){return"function"==typeof depFns[condition]?depFns[condition]($dependon,value):depFns.defaultCondition($dependon,value)}(dependon,condition,value);$.each(elements,(function(idx,elToHide){toHide.hasOwnProperty(elToHide)?toHide[elToHide]=toHide[elToHide]||hide:toHide[elToHide]=hide}))}))}))})),$.each(toHide,(function(elToHide,hide){getElementsByName(elToHide).each((function(idx,el){var $parent=$(el).closest(".form-item");$parent.length&&(hide?$parent.hide():$parent.show())}))}))}return{init:function(opts){dependencies=opts.dependencies,$.each(dependencies,(function(depname){var $el=getElementsByName(depname);$el.length&&$el.on("change",updateDependencies)})),updateDependencies(),$(".form-dependenton").hide()}}}));
//# sourceMappingURL=showhidesettings.min.js.map
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -78,9 +78,9 @@ define(['jquery'], function($) {
*/
function multiSelectMatches($el, values) {
var selected = $el.val() || [];
if (!values.length) {
// No values - nothing to match against.
return false;
if (values.length === 1 && values[0] === '') {
// Values array contains a single empty entry -> value was empty.
return selected.length === 0;
}
if (selected.length !== values.length) {
// Different number of expected and actual values - cannot possibly be a match.
@@ -54,6 +54,13 @@ class behat_form_select extends behat_form_field {
// Here we select the option(s).
if ($multiple) {
// Is the value empty?
if (empty(trim($value))) {
// Reset selection to nothing.
$this->field->setValue([]);
return;
}
// Split and decode values. Comma separated list of values allowed. With valuable commas escaped with backslash.
$options = preg_replace('/\\\,/', ',', preg_split('/(?<!\\\),/', trim($value)));
// This is a multiple select, let's pass the multiple flag after first option.
+44 -32
View File
@@ -502,18 +502,22 @@ if (typeof M.form.dependencyManager === 'undefined') {
selected[selected.length] = this.get('value');
}
});
if (selected.length > 0 && selected.length === values.length) {
for (var i in selected) {
v = selected[i];
if (values.indexOf(v) > -1) {
lock = true;
} else {
lock = false;
return;
}
}
} else {
if (values.length === 1 && values[0] === '') {
// Values array contains a single empty entry -> value was empty.
lock = selected.length === 0;
return;
}
if (selected.length !== values.length) {
lock = false;
return;
}
lock = true;
for (const i in selected) {
v = selected[i];
if (values.indexOf(v) === -1) {
lock = false;
return;
}
}
} else {
lock = lock || this.get('value') == value;
@@ -568,18 +572,22 @@ if (typeof M.form.dependencyManager === 'undefined') {
selected[selected.length] = this.get('value');
}
});
if (selected.length > 0 && selected.length === values.length) {
for (var i in selected) {
v = selected[i];
if (values.indexOf(v) > -1) {
lock = true;
} else {
lock = false;
return;
}
}
} else {
if (values.length === 1 && values[0] === '') {
// Values array contains a single empty entry -> value was empty.
lock = selected.length === 0;
return;
}
if (selected.length !== values.length) {
lock = false;
return;
}
lock = true;
for (const i in selected) {
v = selected[i];
if (values.indexOf(v) === -1) {
lock = false;
return;
}
}
} else {
value = this.get('value');
@@ -633,17 +641,21 @@ if (typeof M.form.dependencyManager === 'undefined') {
selected[selected.length] = this.get('value');
}
});
if (selected.length > 0 && selected.length === values.length) {
for (var i in selected) {
if (values.indexOf(selected[i]) > -1) {
lock = false;
} else {
lock = true;
return;
}
}
} else {
if (values.length === 1 && values[0] === '') {
// Values array contains a single empty entry -> value was empty.
lock = selected.length !== 0;
return;
}
if (selected.length !== values.length) {
lock = true;
return;
}
lock = false;
for (const i in selected) {
if (values.indexOf(selected[i]) === -1) {
lock = true;
return;
}
}
} else {
lock = lock || this.get('value') != value;
+20
View File
@@ -27,3 +27,23 @@ Feature: disabledIf functionality in forms
And the "class" attribute of "#fitem_id_some_static" "css_element" should not contain "text-muted"
And the "#id_some_static_username" "css_element" should be enabled
And the "class" attribute of "Check" "button" should not contain "disabled"
Scenario Outline: Inputs are disabled when disabledIf conditions dependent on a multi-select element are met
Given I am on the "multiselect_hideif_disabledif_form" "core_form > Fixture" page logged in as "admin"
When I set the field "multiselect1" to "<selection>"
Then the "#id_disabledIfEq_" "css_element" should be <enabledEq_>
And the "#id_disabledIfIn_" "css_element" should be <enabledIn_>
And the "#id_disabledIfNeq_" "css_element" should be <enabledNeq_>
And the "#id_disabledIfEq1" "css_element" should be <enabledEq1>
And the "#id_disabledIfIn1" "css_element" should be <enabledIn1>
And the "#id_disabledIfNeq1" "css_element" should be <enabledNeq1>
And the "#id_disabledIfEq12" "css_element" should be <enabledEq12>
And the "#id_disabledIfIn12" "css_element" should be <enabledIn12>
And the "#id_disabledIfNeq12" "css_element" should be <enabledNeq12>
Examples:
| selection | enabledEq_ | enabledIn_ | enabledNeq_ | enabledEq1 | enabledIn1 | enabledNeq1 | enabledEq12 | enabledIn12 | enabledNeq12 |
| | disabled | disabled | enabled | enabled | enabled | disabled | enabled | enabled | disabled |
| Option 1 | enabled | enabled | disabled | disabled | disabled | enabled | enabled | enabled | disabled |
| Option 2 | enabled | enabled | disabled | enabled | enabled | disabled | enabled | enabled | disabled |
| Option 1, Option 2 | enabled | enabled | disabled | enabled | enabled | disabled | disabled | disabled | enabled |
+20
View File
@@ -39,3 +39,23 @@ Feature: hideIf functionality in forms
Then I should not see "Static with form elements"
And I click on "Enable" "radio"
And I should see "Static with form elements"
Scenario Outline: Inputs are hidden when hideIf conditions dependent on a multi-select element are met
Given I am on the "multiselect_hideif_disabledif_form" "core_form > Fixture" page
When I set the field "multiselect1" to "<selection>"
Then I <shouldSeeEq_> see "Hide if selection 'eq' []"
And I <shouldSeeIn_> see "Hide if selection 'in' []"
And I <shouldSeeNeq_> see "Hide if selection 'neq' []"
And I <shouldSeeEq1> see "Hide if selection 'eq' ['1']"
And I <shouldSeeIn1> see "Hide if selection 'in' ['1']"
And I <shouldSeeNeq1> see "Hide if selection 'neq' ['1']"
And I <shouldSeeEq12> see "Hide if selection 'eq' ['1', '2']"
And I <shouldSeeIn12> see "Hide if selection 'in' ['1', '2']"
And I <shouldSeeNeq12> see "Hide if selection 'neq' ['1', '2']"
Examples:
| selection | shouldSeeEq_ | shouldSeeIn_ | shouldSeeNeq_ | shouldSeeEq1 | shouldSeeIn1 | shouldSeeNeq1 | shouldSeeEq12 | shouldSeeIn12 | shouldSeeNeq12 |
| | should not | should not | should | should | should | should not | should | should | should not |
| Option 1 | should | should | should not | should not | should not | should | should | should | should not |
| Option 2 | should | should | should not | should | should | should not | should | should | should not |
| Option 1, Option 2 | should | should | should not | should | should | should not | should not | should not | should |
@@ -0,0 +1,96 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once(__DIR__ . '/../../../../config.php');
defined('BEHAT_SITE_RUNNING') || die();
global $CFG, $PAGE, $OUTPUT;
require_once($CFG->libdir . '/formslib.php');
$PAGE->set_url('/lib/form/tests/fixtures/multiselect_hideif_disabledif_form.php');
$PAGE->add_body_class('limitedwidth');
require_login();
$PAGE->set_context(core\context\system::instance());
/**
* Test class for hiding and disabling elements dependent on a multi-select element.
*
* @package core_form
* @copyright 2024 Lars Bonczek (@innoCampus, TU Berlin)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class test_multiselect_hideif_disabledif_form extends moodleform {
/**
* Form definition.
*/
public function definition(): void {
$mform = $this->_form;
$mform->addElement('select', 'multiselect1', 'multiselect1', [
1 => 'Option 1',
2 => 'Option 2',
], ['multiple' => true]);
$mform->addElement('checkbox', 'disabledIfEq_', "Disabled if selection 'eq' []");
$mform->addElement('checkbox', 'disabledIfIn_', "Disabled if selection 'in' []");
$mform->addElement('checkbox', 'disabledIfNeq_', "Disabled if selection 'neq' []");
$mform->addElement('checkbox', 'disabledIfEq1', "Disabled if selection 'eq' ['1']");
$mform->addElement('checkbox', 'disabledIfIn1', "Disabled if selection 'in' ['1']");
$mform->addElement('checkbox', 'disabledIfNeq1', "Disabled if selection 'neq' ['1']");
$mform->addElement('checkbox', 'disabledIfEq12', "Disabled if selection 'eq' ['1', '2']");
$mform->addElement('checkbox', 'disabledIfIn12', "Disabled if selection 'in' ['1', '2']");
$mform->addElement('checkbox', 'disabledIfNeq12', "Disabled if selection 'neq' ['1', '2']");
$mform->disabledIf('disabledIfEq_', 'multiselect1[]', 'eq', []);
$mform->disabledIf('disabledIfIn_', 'multiselect1[]', 'in', []);
$mform->disabledIf('disabledIfNeq_', 'multiselect1[]', 'neq', []);
$mform->disabledIf('disabledIfEq1', 'multiselect1[]', 'eq', ['1']);
$mform->disabledIf('disabledIfIn1', 'multiselect1[]', 'in', ['1']);
$mform->disabledIf('disabledIfNeq1', 'multiselect1[]', 'neq', ['1']);
$mform->disabledIf('disabledIfEq12', 'multiselect1[]', 'eq', ['1', '2']);
$mform->disabledIf('disabledIfIn12', 'multiselect1[]', 'in', ['1', '2']);
$mform->disabledIf('disabledIfNeq12', 'multiselect1[]', 'neq', ['1', '2']);
$mform->addElement('checkbox', 'hideIfEq_', "Hide if selection 'eq' []");
$mform->addElement('checkbox', 'hideIfIn_', "Hide if selection 'in' []");
$mform->addElement('checkbox', 'hideIfNeq_', "Hide if selection 'neq' []");
$mform->addElement('checkbox', 'hideIfEq1', "Hide if selection 'eq' ['1']");
$mform->addElement('checkbox', 'hideIfIn1', "Hide if selection 'in' ['1']");
$mform->addElement('checkbox', 'hideIfNeq1', "Hide if selection 'neq' ['1']");
$mform->addElement('checkbox', 'hideIfEq12', "Hide if selection 'eq' ['1', '2']");
$mform->addElement('checkbox', 'hideIfIn12', "Hide if selection 'in' ['1', '2']");
$mform->addElement('checkbox', 'hideIfNeq12', "Hide if selection 'neq' ['1', '2']");
$mform->hideIf('hideIfEq_', 'multiselect1[]', 'eq', []);
$mform->hideIf('hideIfIn_', 'multiselect1[]', 'in', []);
$mform->hideIf('hideIfNeq_', 'multiselect1[]', 'neq', []);
$mform->hideIf('hideIfEq1', 'multiselect1[]', 'eq', ['1']);
$mform->hideIf('hideIfIn1', 'multiselect1[]', 'in', ['1']);
$mform->hideIf('hideIfNeq1', 'multiselect1[]', 'neq', ['1']);
$mform->hideIf('hideIfEq12', 'multiselect1[]', 'eq', ['1', '2']);
$mform->hideIf('hideIfIn12', 'multiselect1[]', 'in', ['1', '2']);
$mform->hideIf('hideIfNeq12', 'multiselect1[]', 'neq', ['1', '2']);
$this->add_action_buttons();
}
}
$form = new test_multiselect_hideif_disabledif_form();
echo $OUTPUT->header();
$form->display();
echo $OUTPUT->footer();
@@ -0,0 +1,78 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Test page for admin setting hide_if functionality dependent on a configmultiselect setting.
*
* @package core
* @copyright 2024 Lars Bonczek (@innoCampus, TU Berlin)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../../../config.php');
defined('BEHAT_SITE_RUNNING') || die();
global $CFG, $PAGE, $OUTPUT;
require_once($CFG->libdir . '/adminlib.php');
$PAGE->set_url('/lib/tests/behat/fixtures/multiselect_hide_if_admin_settingspage.php');
require_login();
$PAGE->set_context(core\context\system::instance());
// Set up dummy admin settings page.
$settings = new \admin_settingpage('hide_if_admin_settingspage', 'hide_if Test');
$settings->add(new admin_setting_configmultiselect('multiselect1', 'multiselect1', '', [], [
1 => 'Option 1',
2 => 'Option 2',
]));
$settings->add(new admin_setting_configcheckbox('hideIfEq_', "Hide if selection 'eq' []", '', false));
$settings->add(new admin_setting_configcheckbox('hideIfIn_', "Hide if selection 'in' []", '', false));
$settings->add(new admin_setting_configcheckbox('hideIfNeq_', "Hide if selection 'neq' []", '', false));
$settings->add(new admin_setting_configcheckbox('hideIfEq1', "Hide if selection 'eq' ['1']", '', false));
$settings->add(new admin_setting_configcheckbox('hideIfIn1', "Hide if selection 'in' ['1']", '', false));
$settings->add(new admin_setting_configcheckbox('hideIfNeq1', "Hide if selection 'neq' ['1']", '', false));
$settings->add(new admin_setting_configcheckbox('hideIfEq12', "Hide if selection 'eq' ['1', '2']", '', false));
$settings->add(new admin_setting_configcheckbox('hideIfIn12', "Hide if selection 'in' ['1', '2']", '', false));
$settings->add(new admin_setting_configcheckbox('hideIfNeq12', "Hide if selection 'neq' ['1', '2']", '', false));
$settings->hide_if('hideIfEq_', 'multiselect1[]', 'eq', '');
$settings->hide_if('hideIfIn_', 'multiselect1[]', 'in', '');
$settings->hide_if('hideIfNeq_', 'multiselect1[]', 'neq', '');
$settings->hide_if('hideIfEq1', 'multiselect1[]', 'eq', '1');
$settings->hide_if('hideIfIn1', 'multiselect1[]', 'in', '1');
$settings->hide_if('hideIfNeq1', 'multiselect1[]', 'neq', '1');
$settings->hide_if('hideIfEq12', 'multiselect1[]', 'eq', '1|2');
$settings->hide_if('hideIfIn12', 'multiselect1[]', 'in', '1|2');
$settings->hide_if('hideIfNeq12', 'multiselect1[]', 'neq', '1|2');
echo $OUTPUT->header();
$context = [
'actionurl' => $PAGE->url->out(false),
'sesskey' => sesskey(),
'settings' => $settings->output_html(),
'showsave' => true,
];
echo $OUTPUT->render_from_template('core_admin/settings', $context);
$opts = [
'dependencies' => $settings->get_dependencies_for_javascript(),
];
$PAGE->requires->js_call_amd('core/showhidesettings', 'init', [$opts]);
echo $OUTPUT->footer();
@@ -0,0 +1,28 @@
@core @javascript
Feature: hide_if functionality in admin settings
For admin settings using hide_if functionality
As a user
If I trigger the hide_if condition then the admin setting will be hidden
Background:
Given I log in as "admin"
Scenario Outline: Admin settings are hidden when hide_if conditions dependent on a configmultiselect setting are met
Given I am on fixture page "/lib/tests/behat/fixtures/multiselect_hide_if_admin_settingspage.php"
When I set the field "s__multiselect1[]" to "<selection>"
Then I <shouldSeeEq_> see "Hide if selection 'eq' []"
And I <shouldSeeIn_> see "Hide if selection 'in' []"
And I <shouldSeeNeq_> see "Hide if selection 'neq' []"
And I <shouldSeeEq1> see "Hide if selection 'eq' ['1']"
And I <shouldSeeIn1> see "Hide if selection 'in' ['1']"
And I <shouldSeeNeq1> see "Hide if selection 'neq' ['1']"
And I <shouldSeeEq12> see "Hide if selection 'eq' ['1', '2']"
And I <shouldSeeIn12> see "Hide if selection 'in' ['1', '2']"
And I <shouldSeeNeq12> see "Hide if selection 'neq' ['1', '2']"
Examples:
| selection | shouldSeeEq_ | shouldSeeIn_ | shouldSeeNeq_ | shouldSeeEq1 | shouldSeeIn1 | shouldSeeNeq1 | shouldSeeEq12 | shouldSeeIn12 | shouldSeeNeq12 |
| | should not | should not | should | should | should | should not | should | should | should not |
| Option 1 | should | should | should not | should not | should not | should | should | should | should not |
| Option 2 | should | should | should not | should | should | should not | should | should | should not |
| Option 1, Option 2 | should | should | should not | should | should | should not | should not | should not | should |