| 1 | efrain | 1 | @editor @editor_tiny @tiny_html @javascript
 | 
        
           |  |  | 2 | Feature: Edit HTML in TinyMCE
 | 
        
           |  |  | 3 |   To write rich text - I need to be able to easily edit the HTML.
 | 
        
           |  |  | 4 |   | 
        
           |  |  | 5 |   Scenario: View HTML in TinyMCE source code view
 | 
        
           |  |  | 6 |     Given I log in as "admin"
 | 
        
           |  |  | 7 |     When I open my profile in edit mode
 | 
        
           |  |  | 8 |     And I set the field "Description" to "This is my draft"
 | 
        
           |  |  | 9 |     And I click on the "View > Source code" menu item for the "Description" TinyMCE editor
 | 
        
           |  |  | 10 |     And I should see "Source code"
 | 
        
           |  |  | 11 |     Then I should see "<p>This is my draft</p>" source code for the "Description" TinyMCE editor
 | 
        
           |  |  | 12 |   | 
        
           |  |  | 13 |   Scenario: View multiline HTML with indenting in TinyMCE source code view
 | 
        
           |  |  | 14 |     Given I log in as "admin"
 | 
        
           |  |  | 15 |     When I open my profile in edit mode
 | 
        
           |  |  | 16 |     And I set the field "Description" to "<div><p>This is my draft</p></div>"
 | 
        
           |  |  | 17 |     And I click on the "View > Source code" menu item for the "Description" TinyMCE editor
 | 
        
           |  |  | 18 |     And I should see "Source code"
 | 
        
           |  |  | 19 |     Then I should see this multiline source code for the "Description" TinyMCE editor:
 | 
        
           |  |  | 20 |       """
 | 
        
           |  |  | 21 |       <div>
 | 
        
           |  |  | 22 |         <p>This is my draft</p>
 | 
        
           |  |  | 23 |       </div>
 | 
        
           |  |  | 24 |       """
 | 
        
           | 1441 | ariadna | 25 |   | 
        
           |  |  | 26 |   Scenario: Permissions can be configured to control access to HTML features
 | 
        
           |  |  | 27 |     Given the following "users" exist:
 | 
        
           |  |  | 28 |       | username | firstname | lastname | email                |
 | 
        
           |  |  | 29 |       | teacher1 | Teacher   | 1        | teacher1@example.com |
 | 
        
           |  |  | 30 |       | teacher2 | Teacher   | 2        | teacher2@example.com |
 | 
        
           |  |  | 31 |     And the following "courses" exist:
 | 
        
           |  |  | 32 |       | fullname | shortname | format |
 | 
        
           |  |  | 33 |       | Course 1 | C1        | topics |
 | 
        
           |  |  | 34 |     And the following "roles" exist:
 | 
        
           |  |  | 35 |       | name           | shortname | description         | archetype      |
 | 
        
           |  |  | 36 |       | Custom teacher | custom1   | Limited permissions | editingteacher |
 | 
        
           |  |  | 37 |     And the following "course enrolments" exist:
 | 
        
           |  |  | 38 |       | user     | course | role           |
 | 
        
           |  |  | 39 |       | teacher1 | C1     | editingteacher |
 | 
        
           |  |  | 40 |       | teacher2 | C1     | custom1        |
 | 
        
           |  |  | 41 |     And the following "activity" exists:
 | 
        
           |  |  | 42 |       | activity | assign          |
 | 
        
           |  |  | 43 |       | course   | C1              |
 | 
        
           |  |  | 44 |       | name     | Test assignment |
 | 
        
           |  |  | 45 |     And the following "permission overrides" exist:
 | 
        
           |  |  | 46 |       | capability    | permission | role    | contextlevel | reference |
 | 
        
           |  |  | 47 |       | tiny/html:use | Prohibit   | custom1 | Course       | C1        |
 | 
        
           |  |  | 48 |     # Check plugin access as a role with prohibited permissions.
 | 
        
           |  |  | 49 |     And I log in as "teacher2"
 | 
        
           |  |  | 50 |     And I am on the "Test assignment" Activity page
 | 
        
           |  |  | 51 |     And I navigate to "Settings" in current page administration
 | 
        
           |  |  | 52 |     And I set the field "Activity instructions" to "<div><p>This is my draft</p></div>"
 | 
        
           |  |  | 53 |     When I click on the "View > Source code" menu item for the "Activity instructions" TinyMCE editor
 | 
        
           |  |  | 54 |     Then "#id_activityeditor_codeMirrorContainer" "css_element" should not exist
 | 
        
           |  |  | 55 |     # Check plugin access as a role with allowed permissions.
 | 
        
           |  |  | 56 |     And I log in as "teacher1"
 | 
        
           |  |  | 57 |     And I am on the "Test assignment" Activity page
 | 
        
           |  |  | 58 |     And I navigate to "Settings" in current page administration
 | 
        
           |  |  | 59 |     And I set the field "Activity instructions" to "<div><p>This is my draft</p></div>"
 | 
        
           |  |  | 60 |     And I click on the "View > Source code" menu item for the "Activity instructions" TinyMCE editor
 | 
        
           |  |  | 61 |     And "#id_activityeditor_codeMirrorContainer" "css_element" should exist
 |