1 |
efrain |
1 |
@core @javascript @core_form
|
|
|
2 |
Feature: disabledIf functionality in forms
|
|
|
3 |
For forms including disabledIf functions
|
|
|
4 |
As a user
|
|
|
5 |
If I trigger the disabledIf condition then the form elements will be disabled
|
|
|
6 |
|
1441 |
ariadna |
7 |
# Note: if you are looking for the Behat tests for the filepicker widget,
|
|
|
8 |
# you will find them in repository/tests/behat.
|
1 |
efrain |
9 |
|
|
|
10 |
Scenario: The file manager is disabled when disabledIf conditions are met
|
1441 |
ariadna |
11 |
Given I am on the "filemanager_hideif_disabledif_form" "core_form > Fixture" page logged in as "admin"
|
1 |
efrain |
12 |
When I click on "Disable" "radio"
|
|
|
13 |
# Test standard file manager.
|
|
|
14 |
Then the "disabled" attribute of "input#id_some_filemanager" "css_element" should contain "true"
|
|
|
15 |
# Test file manager in a group.
|
|
|
16 |
And the "disabled" attribute of "input#id_filemanager_group_some_filemanager_group" "css_element" should contain "true"
|
11 |
efrain |
17 |
|
|
|
18 |
Scenario: The static element is disabled when 'eq' disabledIf conditions are met
|
1441 |
ariadna |
19 |
Given I log in as "admin"
|
|
|
20 |
And I am on fixture page "/lib/form/tests/behat/fixtures/static_hideif_disabledif_form.php"
|
11 |
efrain |
21 |
And I should see "Static with form elements"
|
|
|
22 |
When I click on "Disable" "radio"
|
|
|
23 |
And the "class" attribute of "#fitem_id_some_static" "css_element" should contain "text-muted"
|
|
|
24 |
And the "disabled" attribute of "input#id_some_static_username" "css_element" should contain "true"
|
|
|
25 |
And the "disabled" attribute of "Check" "button" should contain "true"
|
|
|
26 |
Then I click on "Enable" "radio"
|
|
|
27 |
And the "class" attribute of "#fitem_id_some_static" "css_element" should not contain "text-muted"
|
|
|
28 |
And the "#id_some_static_username" "css_element" should be enabled
|
|
|
29 |
And the "class" attribute of "Check" "button" should not contain "disabled"
|
1441 |
ariadna |
30 |
|
|
|
31 |
Scenario: The file picker element is disabled when 'eq' disabledIf conditions are met
|
|
|
32 |
Given I am on the "filepicker_hideif_disabledif_form" "core_form > Fixture" page logged in as "admin"
|
|
|
33 |
And the "#id_filepicker" "css_element" should be enabled
|
|
|
34 |
When I click on "Disable" "radio"
|
|
|
35 |
Then the "#id_filepicker" "css_element" should be disabled
|
|
|
36 |
|
|
|
37 |
@_file_upload
|
|
|
38 |
Scenario: The other element is disabled when the file picker is not empty
|
|
|
39 |
Given I am on the "filepicker_hideif_disabledif_form" "core_form > Fixture" page logged in as "admin"
|
|
|
40 |
When I upload "lib/ddl/tests/fixtures/xmldb_table.xml" file to "File picker" filemanager
|
|
|
41 |
Then the "inputtext1" "field" should be disabled
|
|
|
42 |
|
|
|
43 |
Scenario Outline: Inputs are disabled when disabledIf conditions dependent on a multi-select element are met
|
|
|
44 |
Given I am on the "multiselect_hideif_disabledif_form" "core_form > Fixture" page logged in as "admin"
|
|
|
45 |
When I set the field "multiselect1" to "<selection>"
|
|
|
46 |
Then the "#id_disabledIfEq_" "css_element" should be <enabledEq_>
|
|
|
47 |
And the "#id_disabledIfIn_" "css_element" should be <enabledIn_>
|
|
|
48 |
And the "#id_disabledIfNeq_" "css_element" should be <enabledNeq_>
|
|
|
49 |
And the "#id_disabledIfEq1" "css_element" should be <enabledEq1>
|
|
|
50 |
And the "#id_disabledIfIn1" "css_element" should be <enabledIn1>
|
|
|
51 |
And the "#id_disabledIfNeq1" "css_element" should be <enabledNeq1>
|
|
|
52 |
And the "#id_disabledIfEq12" "css_element" should be <enabledEq12>
|
|
|
53 |
And the "#id_disabledIfIn12" "css_element" should be <enabledIn12>
|
|
|
54 |
And the "#id_disabledIfNeq12" "css_element" should be <enabledNeq12>
|
|
|
55 |
|
|
|
56 |
Examples:
|
|
|
57 |
| selection | enabledEq_ | enabledIn_ | enabledNeq_ | enabledEq1 | enabledIn1 | enabledNeq1 | enabledEq12 | enabledIn12 | enabledNeq12 |
|
|
|
58 |
| | disabled | disabled | enabled | enabled | enabled | disabled | enabled | enabled | disabled |
|
|
|
59 |
| Option 1 | enabled | enabled | disabled | disabled | disabled | enabled | enabled | disabled | disabled |
|
|
|
60 |
| Option 2 | enabled | enabled | disabled | enabled | enabled | disabled | enabled | disabled | disabled |
|
|
|
61 |
| Option 1, Option 2 | enabled | enabled | disabled | enabled | enabled | disabled | disabled | disabled | enabled |
|