Merge branch 'MDL-68548' of https://github.com/Neosi/moodle
[moodle.git] / lib / editor / atto / tests / behat / disablecontrol.feature
1 @editor @editor_atto @atto @editor_moodleform
2 Feature: Atto with enable/disable function.
3   In order to test enable/disable function
4   I create a sample page to test this feature.
5   As a user
6   I need to enable/disable all buttons/plugins and content of editor if "enable/disable" feature enabled.
8   Background:
9     Given the following "courses" exist:
10       | fullname | shortname | format |
11       | Course 1 | C1        | topics |
12     And the following "activities" exist:
13       | activity | name | intro                                                                                              | course | idnumber |
14       | label    | L1   | <a href="../lib/editor/tests/fixtures/disable_control_example.php">Control Enable/Disable Atto</a> | C1     | label1   |
15     And I log in as "admin"
16     And I am on "Course 1" course homepage
17     And I follow "Control Enable/Disable Atto"
19   @javascript
20   Scenario: Check disable Atto editor.
21     When I set the field "mycontrol" to "Disable"
22     Then the "disabled" attribute of "button.atto_collapse_button" "css_element" should contain "disabled"
23     And the "disabled" attribute of "button.atto_title_button" "css_element" should contain "disabled"
24     And the "disabled" attribute of "button.atto_bold_button" "css_element" should contain "disabled"
25     And the "disabled" attribute of "button.atto_italic_button" "css_element" should contain "disabled"
26     And the "disabled" attribute of "button.atto_unorderedlist_button_insertUnorderedList" "css_element" should contain "disabled"
27     And the "disabled" attribute of "button.atto_orderedlist_button_insertOrderedList" "css_element" should contain "disabled"
28     And the "disabled" attribute of "button.atto_link_button" "css_element" should contain "disabled"
29     And the "disabled" attribute of "button.atto_link_button_unlink" "css_element" should contain "disabled"
30     And the "disabled" attribute of "button.atto_image_button" "css_element" should contain "disabled"
31     And the "contenteditable" attribute of "div#id_myeditoreditable" "css_element" should contain "false"
33   @javascript
34   Scenario: Check enable Atto editor.
35     When I set the field "mycontrol" to "Enable"
36     Then "button.atto_collapse_button[disabled]" "css_element" should not exist
37     And "button.atto_title_button[disabled]" "css_element" should not exist
38     And "button.atto_bold_button[disabled]" "css_element" should not exist
39     And "button.atto_italic_button[disabled]" "css_element" should not exist
40     And "button.atto_unorderedlist_button_insertUnorderedList[disabled]" "css_element" should not exist
41     And "button.atto_orderedlist_button_insertOrderedList[disabled]" "css_element" should not exist
42     And "button.atto_link_button[disabled]" "css_element" should not exist
43     And "button.atto_link_button_unlink[disabled]" "css_element" should not exist
44     And "button.atto_image_button[disabled]" "css_element" should not exist
45     And the "contenteditable" attribute of "div#id_myeditoreditable" "css_element" should contain "true"