1 |
efrain |
1 |
@core @javascript @core_form
|
|
|
2 |
Feature: hideIf functionality in forms
|
|
|
3 |
For forms including hideIf functions
|
|
|
4 |
As a user
|
|
|
5 |
If I trigger the hideIf condition then the form elements will be hidden
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname |
|
|
|
10 |
| Course 1 | C1 |
|
|
|
11 |
And I log in as "admin"
|
|
|
12 |
|
|
|
13 |
Scenario: When 'eq' hideIf conditions are not met, the relevant elements are shown
|
|
|
14 |
When I add an assign activity to course "Course 1" section "1"
|
|
|
15 |
And I expand all fieldsets
|
|
|
16 |
And I set the field "Students submit in groups" to "Yes"
|
|
|
17 |
Then I should see "Require group to make submission"
|
|
|
18 |
And I should see "Require all group members submit"
|
|
|
19 |
And I should see "Grouping for student groups"
|
|
|
20 |
|
|
|
21 |
Scenario: When 'eq' hideIf conditions are met, the relevant elements are hidden
|
|
|
22 |
When I add a assign activity to course "Course 1" section "1"
|
|
|
23 |
And I expand all fieldsets
|
|
|
24 |
And I set the field "Students submit in groups" to "No"
|
|
|
25 |
Then I should not see "Require group to make submission"
|
|
|
26 |
And I should not see "Require all group members to submit"
|
|
|
27 |
And I should not see "Grouping for student groups"
|
11 |
efrain |
28 |
|
|
|
29 |
Scenario: The editor is hidden when 'eq' hideIf conditions are met
|
|
|
30 |
Given I am on fixture page "/lib/form/tests/behat/fixtures/editor_hideif_disabledif_form.php"
|
|
|
31 |
And I should see "My test editor"
|
|
|
32 |
When I click on "Hide" "radio"
|
|
|
33 |
Then I should not see "My test editor"
|
|
|
34 |
|
|
|
35 |
Scenario: The static element is hidden when 'eq' hideIf conditions are met
|
|
|
36 |
Given I am on fixture page "/lib/form/tests/behat/fixtures/static_hideif_disabledif_form.php"
|
|
|
37 |
And I should see "Static with form elements"
|
|
|
38 |
When I click on "Hide" "radio"
|
|
|
39 |
Then I should not see "Static with form elements"
|
|
|
40 |
And I click on "Enable" "radio"
|
|
|
41 |
And I should see "Static with form elements"
|
1441 |
ariadna |
42 |
|
|
|
43 |
Scenario: The file picker element is hidden when 'eq' hideIf conditions are met
|
|
|
44 |
Given I am on the "filepicker_hideif_disabledif_form" "core_form > Fixture" page logged in as "admin"
|
|
|
45 |
And "#fitem_id_filepicker" "css_element" should be visible
|
|
|
46 |
When I click on "Hide" "radio"
|
|
|
47 |
Then "#fitem_id_filepicker" "css_element" should not be visible
|
|
|
48 |
|
|
|
49 |
@_file_upload
|
|
|
50 |
Scenario: The other element is hidden when the file picker is not empty
|
|
|
51 |
Given I am on the "filepicker_hideif_disabledif_form" "core_form > Fixture" page logged in as "admin"
|
|
|
52 |
When I upload "lib/ddl/tests/fixtures/xmldb_table.xml" file to "File picker" filemanager
|
|
|
53 |
Then I should not see "inputtext2"
|
|
|
54 |
|
|
|
55 |
Scenario Outline: Inputs are hidden when hideIf conditions dependent on a multi-select element are met
|
|
|
56 |
Given I am on the "multiselect_hideif_disabledif_form" "core_form > Fixture" page
|
|
|
57 |
When I set the field "multiselect1" to "<selection>"
|
|
|
58 |
Then I <shouldSeeEq_> see "Hide if selection 'eq' []"
|
|
|
59 |
And I <shouldSeeIn_> see "Hide if selection 'in' []"
|
|
|
60 |
And I <shouldSeeNeq_> see "Hide if selection 'neq' []"
|
|
|
61 |
And I <shouldSeeEq1> see "Hide if selection 'eq' ['1']"
|
|
|
62 |
And I <shouldSeeIn1> see "Hide if selection 'in' ['1']"
|
|
|
63 |
And I <shouldSeeNeq1> see "Hide if selection 'neq' ['1']"
|
|
|
64 |
And I <shouldSeeEq12> see "Hide if selection 'eq' ['1', '2']"
|
|
|
65 |
And I <shouldSeeIn12> see "Hide if selection 'in' ['1', '2']"
|
|
|
66 |
And I <shouldSeeNeq12> see "Hide if selection 'neq' ['1', '2']"
|
|
|
67 |
|
|
|
68 |
Examples:
|
|
|
69 |
| selection | shouldSeeEq_ | shouldSeeIn_ | shouldSeeNeq_ | shouldSeeEq1 | shouldSeeIn1 | shouldSeeNeq1 | shouldSeeEq12 | shouldSeeIn12 | shouldSeeNeq12 |
|
|
|
70 |
| | should not | should not | should | should | should | should not | should | should | should not |
|
|
|
71 |
| Option 1 | should | should | should not | should not | should not | should | should | should not | should not |
|
|
|
72 |
| Option 2 | should | should | should not | should | should | should not | should | should not | should not |
|
|
|
73 |
| Option 1, Option 2 | should | should | should not | should | should | should not | should not | should not | should |
|