Merge branch 'MDL-44871-master' of git://github.com/damyon/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2014-06-12 11:38:10 +02:00
commit 0272001830
39 changed files with 617 additions and 6 deletions

View File

@ -65,6 +65,32 @@ editor.set("value", "' . $value . '");
}
}
/**
* Select all the text in the form field.
*
*/
public function select_text() {
// NodeElement.keyPress simply doesn't work.
if (!$this->running_javascript()) {
throw new coding_exception('Selecting text requires javascript.');
}
$editorid = $this->field->getAttribute('id');
$js = ' (function() {
var e = document.getElementById("'.$editorid.'editable"),
r = rangy.createRange(),
s = rangy.getSelection();
while ((e.firstChild !== null) && (e.firstChild.nodeType != document.TEXT_NODE)) {
e = e.firstChild;
}
e.focus();
r.selectNodeContents(e);
s.setSingleRange(r);
}()); ';
$this->session->executeScript($js);
}
/**
* Matches the provided value against the current field value.
*

View File

@ -235,5 +235,4 @@ class behat_form_field {
return $this->fieldlocator;
}
}

View File

@ -0,0 +1,21 @@
@editor @editor_atto @atto @atto_accessibilitychecker
Feature: Atto accessibility checker
To write accessible text in Atto, I need to check for accessibility warnings.
@javascript
Scenario: Images with no alt
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>Some plain text</p><img src='/broken-image'/><p>Some more text</p>"
When I click on "Show more buttons" "button"
And I click on "Accessibility checker" "button"
Then I should see "Images require alternative text."
@javascript
Scenario: Low contrast
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p style='color: #7c7cff; background-color: #ffffff;'>Hard to read</p>"
When I click on "Show more buttons" "button"
And I click on "Accessibility checker" "button"
Then I should see "The colours of the foreground and background text do not have enough contrast."

View File

@ -0,0 +1,33 @@
@editor @editor_atto @atto @atto_accessibilityhelper
Feature: Atto accessibility helper
To use a screen reader effectively in Atto, I may need additional information about the text
@javascript
Scenario: Images and links
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>Some plain text</p><img src='/broken-image' alt='Image 1'/><p><a href='#fsd'>Some link text</a></p>"
And I select the text in the "Description" Atto editor
When I click on "Show more buttons" "button"
And I click on "Screenreader helper" "button"
Then I should see "Links in text editor"
And I should see "Some link text"
And I should see "Images in text editor"
And I should see "Image 1"
And I should not see "No images"
And I should not see "No links"
@javascript
Scenario: Styles
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>Some plain text</p>"
When I click on "Show more buttons" "button"
And I select the text in the "Description" Atto editor
And I click on "Unordered list" "button"
And I click on "Screenreader helper" "button"
And I select the text in the "Description" Atto editor
# This shows the current HTML tags applied to the selected text.
# This is required because they are not always read by a screen reader.
Then I should see "UL, LI"

View File

@ -0,0 +1,44 @@
@editor @editor_atto @atto @atto_align
Feature: Atto align text
To format text in Atto, I need to use the align buttons.
@javascript
Scenario: Right align some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>Fascism</p>"
And I set the field "Text editor" to "Plain text area"
And I click on "Show more buttons" "button"
And I select the text in the "Description" Atto editor
When I click on "Right align" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "style=\"text-align:right;\""
@javascript
Scenario: Left align some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>Communism</p>"
And I set the field "Text editor" to "Plain text area"
And I click on "Show more buttons" "button"
And I select the text in the "Description" Atto editor
When I click on "Right align" "button"
And I click on "Left align" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "style=\"text-align:left;\""
@javascript
Scenario: Center align some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>United Future</p>"
And I set the field "Text editor" to "Plain text area"
And I click on "Show more buttons" "button"
And I select the text in the "Description" Atto editor
When I click on "Center" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "style=\"text-align:center;\""

View File

@ -0,0 +1,29 @@
@editor @editor_atto @atto @atto_bold @_bug_phantomjs
Feature: Atto bold button
To format text in Atto, I need to use the bold button.
@javascript
Scenario: Bold some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Text editor" to "Plain text area"
And I set the field "Description" to "Badger"
And I select the text in the "Description" Atto editor
When I click on "Bold" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<b>Badger</b>"
@javascript
Scenario: Unbold some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Text editor" to "Plain text area"
And I set the field "Description" to "Mouse"
And I select the text in the "Description" Atto editor
When I click on "Bold" "button"
And I click on "Bold" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should not see "<b>Mouse</b>"
And I should see "Mouse"

View File

@ -0,0 +1,18 @@
@editor @editor_atto @atto @atto_charmap
Feature: Atto charmap button
To format text in Atto, I need to add symbols
@javascript
Scenario: Insert symbols
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Text editor" to "Plain text area"
And I set the field "Description" to "<p>1980 Mullet</p>"
And I select the text in the "Description" Atto editor
When I click on "Show more buttons" "button"
And I click on "Insert character" "button"
And I click on "copyright sign" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "(c)"

View File

@ -410,6 +410,9 @@ Y.namespace('M.atto_charmap').Button = Y.Base.create('button', Y.M.editor_atto.E
// And add the character.
host.insertContentAtFocusPoint(character);
// And mark the text area as updated.
this.markUpdated();
}
});

File diff suppressed because one or more lines are too long

View File

@ -410,6 +410,9 @@ Y.namespace('M.atto_charmap').Button = Y.Base.create('button', Y.M.editor_atto.E
// And add the character.
host.insertContentAtFocusPoint(character);
// And mark the text area as updated.
this.markUpdated();
}
});

View File

@ -408,5 +408,8 @@ Y.namespace('M.atto_charmap').Button = Y.Base.create('button', Y.M.editor_atto.E
// And add the character.
host.insertContentAtFocusPoint(character);
// And mark the text area as updated.
this.markUpdated();
}
});

View File

@ -0,0 +1,17 @@
@editor @editor_atto @atto @atto_clear @_bug_phantomjs
Feature: Atto clear button
To format text in Atto, I need to remove formatting
@javascript
Scenario: Clear formatting
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Text editor" to "Plain text area"
And I set the field "Description" to "<p><i>Pisa</i></p>"
When I click on "Show more buttons" "button"
And I select the text in the "Description" Atto editor
And I click on "Clear formatting" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should not see "<i>Pisa"

View File

@ -0,0 +1,13 @@
@editor @editor_atto @atto @atto_collapse
Feature: Atto collapse button
To access all the tools in Atto, I need to toggle the toolbar
@javascript
Scenario: Toggle toolbar
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
When I click on "Show more buttons" "button"
Then "Equation editor" "button" should be visible
And I click on "Show fewer buttons" "button"
Then "Equation editor" "button" should not be visible

View File

@ -0,0 +1,21 @@
@editor @editor_atto @atto @atto_equation
Feature: Atto equation editor
To teach maths to students, I need to write equations
@javascript
Scenario: Create an equation
Given I log in as "admin"
When I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>Equation test</p>"
# Set field on the bottom of page, so equation editor dialogue is visible.
And I expand all fieldsets
And I set the field "Picture description" to "Test"
And I select the text in the "Description" Atto editor
And I click on "Show more buttons" "button"
And I click on "Equation editor" "button"
And I set the field "Edit equation using" to " = 1 \div 0"
And I click on "\infty" "button"
And I click on "Save equation" "button"
And I click on "Update profile" "button"
Then "\infty" "text" should exist

View File

@ -0,0 +1,13 @@
@editor @editor_atto @atto @atto_html
Feature: Atto edit HTML
To write advanced HTML, I need to edit the HTML source code
@javascript
Scenario: Edit the html source
Given I log in as "admin"
When I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p style=\"color: blue;\">Smurf</p>"
And I click on "Show more buttons" "button"
And I click on "HTML" "button"
Then the field "Description" matches value "<p style=\"color: blue;\">Smurf</p>"

View File

@ -0,0 +1,28 @@
@editor @editor_atto @atto @atto_image @_file_upload
Feature: Add images to Atto
To write rich text - I need to add images.
@javascript
Scenario: Insert an image
Given I log in as "admin"
And I navigate to "My private files" node in "My profile"
And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager
And I click on "Save changes" "button"
When I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>Image test</p>"
And I select the text in the "Description" Atto editor
And I click on "Image" "button"
And I click on "Browse repositories..." "button"
And I click on "Private files" "link"
And I click on "moodle-logo.png" "link"
And I click on "Select this file" "button"
And I set the field "Describe this image" to "It's the Moodle"
# Wait for the page to "settle".
And I wait "2" seconds
And I click on "Save image" "button"
And I click on "Update profile" "button"
And I follow "Edit profile"
And I select the text in the "Description" Atto editor
And I click on "Image" "button"
Then the field "Describe this image" matches value "It's the Moodle"

View File

@ -0,0 +1,30 @@
@editor @editor_atto @atto @atto_indent
Feature: Indent text in Atto
To write rich text - I need to indent and outdent things.
@javascript
Scenario: Indent
Given I log in as "admin"
When I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>I need some space.</p>"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
And I click on "Show more buttons" "button"
And I click on "Indent" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "class=\"editor-indent\""
@javascript
Scenario: Indent and outdent
Given I log in as "admin"
When I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "<p>I need some space.</p>"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
And I click on "Show more buttons" "button"
And I click on "Indent" "button"
And I click on "Outdent" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should not see "class=\"editor-indent\""

View File

@ -0,0 +1,29 @@
@editor @editor_atto @atto @atto_italic @_bug_phantomjs
Feature: Atto italic button
To format text in Atto, I need to use the italic button.
@javascript
Scenario: Italicise some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "Tower of Pisa"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
When I click on "Italic" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<i>Tower of Pisa</i>"
@javascript
Scenario: Toggle italics in some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "GHD - for hair"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
When I click on "Italic" "button"
And I click on "Italic" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should not see "<i>GHD - for hair</i>"
And I should see "GHD - for hair"

View File

@ -0,0 +1,23 @@
@editor @editor_atto @atto @atto_link @_file_upload
Feature: Add links to Atto
To write rich text - I need to add links.
@javascript
Scenario: Insert a links
Given I log in as "admin"
And I navigate to "My private files" node in "My profile"
And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager
And I click on "Save changes" "button"
When I navigate to "Edit profile" node in "My profile settings"
And I set the field "Text editor" to "Plain text area"
And I set the field "Description" to "Super cool"
And I select the text in the "Description" Atto editor
And I click on "Link" "button"
And I click on "Browse repositories..." "button"
And I click on "Private files" "link"
And I click on "moodle-logo.png" "link"
And I click on "Select this file" "button"
And I click on "Update profile" "button"
And I follow "Edit profile"
Then I should see "Super cool</a>"

View File

@ -183,6 +183,8 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.get('host').setSelection(this._currentSelection);
document.execCommand('unlink', false, null);
document.execCommand('createLink', false, params.url);
// And mark the text area as updated.
this.markUpdated();
}
},

View File

@ -1 +1 @@
YUI.add("moodle-atto_link-button",function(e,t){var n="atto_link",r={NEWWINDOW:"atto_link_openinnewwindow",URLINPUT:"atto_link_urlentry"},i={URLINPUT:".atto_link_urlentry"},s='<form class="atto_form"><label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth url {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>{{#if showFilepicker}}<button class="openlinkbrowser">{{get_string "browserepositories" component}}</button><br/>{{/if}}<input type="checkbox" class="newwindow" id="{{elementid}}_{{CSS.NEWWINDOW}}"/><label class="sameline" for="{{elementid}}_{{CSS.NEWWINDOW}}">{{get_string "openinnewwindow" component}}</label><br/><div class="mdl-align"><br/><button type="submit" class="submit">{{get_string "createlink" component}}</button></div></form>';e.namespace("M.atto_link").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.addButton({icon:"e/insert_edit_link",callback:this._displayDialogue,tags:"a",tagMatchRequiresAll:!1}),this.addButton({buttonName:"unlink",callback:this._unlink,icon:"e/remove_link",title:"unlink",tags:"a",tagMatchRequiresAll:!1})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1||this._currentSelection.collapsed)return;var e=this.getDialogue({headerContent:M.util.get_string("createlink",n),focusAfterHide:!0,focusOnShowSelector:i.URLINPUT});e.set("bodyContent",this._getDialogueContent()),this._resolveAnchors(),e.show()},_resolveAnchors:function(){var t=this.get("host").getSelectionParentNode(),n,r,i,s;if(!t)return;n=this._findSelectedAnchors(e.one(t)),n.length>0&&(r=n[0],this._currentSelection=this.get("host").getSelectionFromNode(r),i=r.getAttribute("href"),s=r.getAttribute("target"),i!==""&&this._content.one(".url").setAttribute("value",i),s==="_blank"?this._content.one(".newwindow").setAttribute("checked","checked"):this._content.one(".newwindow").removeAttribute("checked"))},_filepickerCallback:function(e){this.getDialogue().set("focusAfterHide",null).hide(),e.url!==""&&(this.get("host").setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},_setLink:function(t){var n,r,i,s,o,u=this.get("host");t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=this._content.one(".url"),o=n.get("value");if(o!==""){this.editor.focus(),u.setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,o),i=u.getSelectionParentNode();if(!i)return;s=this._findSelectedAnchors(e.one(i)),e.Array.each(s,function(e){r=this._content.one(".newwindow"),r.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")},this),this.markUpdated()}},_findSelectedAnchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&this.get("host").selectionContainsNode(e)&&r.push(e)},this),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},_getDialogueContent:function(){var t=this.get("host").canShowFilepicker("link"),i=e.Handlebars.compile(s);return this._content=e.Node.create(i({showFilepicker:t,component:n,CSS:r})),this._content.one(".submit").on("click",this._setLink,this),t&&this._content.one(".openlinkbrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("link",this._filepickerCallback,this)},this),this._content},_unlink:function(){var e=this.get("host"),t=e.getSelection();if(t&&t.length)if(t[0].startOffset===t[0].endOffset){var n=e.getSelectedNodes();n&&(n.each(function(t){var n=t.ancestor("a",!0);n&&(e.setSelection(e.getSelectionFromNode(n)),document.execCommand("unlink",!1,null))},this),this.markUpdated())}else document.execCommand("unlink",!1,null),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
YUI.add("moodle-atto_link-button",function(e,t){var n="atto_link",r={NEWWINDOW:"atto_link_openinnewwindow",URLINPUT:"atto_link_urlentry"},i={URLINPUT:".atto_link_urlentry"},s='<form class="atto_form"><label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth url {{CSS.URLINPUT}}" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>{{#if showFilepicker}}<button class="openlinkbrowser">{{get_string "browserepositories" component}}</button><br/>{{/if}}<input type="checkbox" class="newwindow" id="{{elementid}}_{{CSS.NEWWINDOW}}"/><label class="sameline" for="{{elementid}}_{{CSS.NEWWINDOW}}">{{get_string "openinnewwindow" component}}</label><br/><div class="mdl-align"><br/><button type="submit" class="submit">{{get_string "createlink" component}}</button></div></form>';e.namespace("M.atto_link").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.addButton({icon:"e/insert_edit_link",callback:this._displayDialogue,tags:"a",tagMatchRequiresAll:!1}),this.addButton({buttonName:"unlink",callback:this._unlink,icon:"e/remove_link",title:"unlink",tags:"a",tagMatchRequiresAll:!1})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1||this._currentSelection.collapsed)return;var e=this.getDialogue({headerContent:M.util.get_string("createlink",n),focusAfterHide:!0,focusOnShowSelector:i.URLINPUT});e.set("bodyContent",this._getDialogueContent()),this._resolveAnchors(),e.show()},_resolveAnchors:function(){var t=this.get("host").getSelectionParentNode(),n,r,i,s;if(!t)return;n=this._findSelectedAnchors(e.one(t)),n.length>0&&(r=n[0],this._currentSelection=this.get("host").getSelectionFromNode(r),i=r.getAttribute("href"),s=r.getAttribute("target"),i!==""&&this._content.one(".url").setAttribute("value",i),s==="_blank"?this._content.one(".newwindow").setAttribute("checked","checked"):this._content.one(".newwindow").removeAttribute("checked"))},_filepickerCallback:function(e){this.getDialogue().set("focusAfterHide",null).hide(),e.url!==""&&(this.get("host").setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url),this.markUpdated())},_setLink:function(t){var n,r,i,s,o,u=this.get("host");t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=this._content.one(".url"),o=n.get("value");if(o!==""){this.editor.focus(),u.setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,o),i=u.getSelectionParentNode();if(!i)return;s=this._findSelectedAnchors(e.one(i)),e.Array.each(s,function(e){r=this._content.one(".newwindow"),r.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")},this),this.markUpdated()}},_findSelectedAnchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&this.get("host").selectionContainsNode(e)&&r.push(e)},this),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},_getDialogueContent:function(){var t=this.get("host").canShowFilepicker("link"),i=e.Handlebars.compile(s);return this._content=e.Node.create(i({showFilepicker:t,component:n,CSS:r})),this._content.one(".submit").on("click",this._setLink,this),t&&this._content.one(".openlinkbrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("link",this._filepickerCallback,this)},this),this._content},_unlink:function(){var e=this.get("host"),t=e.getSelection();if(t&&t.length)if(t[0].startOffset===t[0].endOffset){var n=e.getSelectedNodes();n&&(n.each(function(t){var n=t.ancestor("a",!0);n&&(e.setSelection(e.getSelectionFromNode(n)),document.execCommand("unlink",!1,null))},this),this.markUpdated())}else document.execCommand("unlink",!1,null),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});

View File

@ -183,6 +183,8 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.get('host').setSelection(this._currentSelection);
document.execCommand('unlink', false, null);
document.execCommand('createLink', false, params.url);
// And mark the text area as updated.
this.markUpdated();
}
},

View File

@ -181,6 +181,8 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.get('host').setSelection(this._currentSelection);
document.execCommand('unlink', false, null);
document.execCommand('createLink', false, params.url);
// And mark the text area as updated.
this.markUpdated();
}
},

View File

@ -0,0 +1,27 @@
@editor @editor_atto @atto @atto_media @_file_upload
Feature: Add media to Atto
To write rich text - I need to add media.
@javascript
Scenario: Insert some media
Given I log in as "admin"
And I navigate to "My private files" node in "My profile"
And I upload "lib/editor/atto/tests/fixtures/moodle-logo.webm" file to "Files" filemanager
And I click on "Save changes" "button"
When I am on homepage
And I expand "My profile" node
And I expand "Blogs" node
And I follow "Add a new entry"
And I set the field "Blog entry body" to "<p>Media test</p>"
And I select the text in the "Blog entry body" Atto editor
And I set the field "Entry title" to "The best video in the entire world (not really)"
And I click on "Media" "button"
And I click on "Browse repositories..." "button"
And I click on "Private files" "link"
And I click on "moodle-logo.webm" "link"
And I click on "Select this file" "button"
And I set the field "Enter name" to "It's the logo"
And I click on "Insert media" "button"
And I click on "Save changes" "button"
Then "video" "css_element" should be visible

View File

@ -0,0 +1,16 @@
@editor @editor_atto @atto @atto_orderedlist @_bug_phantomjs
Feature: Atto ordered list button
To format text in Atto, I need to use the ordered list button.
@javascript
Scenario: Make a list from some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "Have you heard the news everyone's talking<br/> Life is good 'cause everything's awesome<br/>"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
When I click on "Ordered list" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<ol><li>Have you heard the news everyone's talking"

View File

@ -0,0 +1,17 @@
@editor @editor_atto @atto @atto_strike @_bug_phantomjs
Feature: Atto strike button
To format text in Atto, I need to use the strike button.
@javascript
Scenario: Strike some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "MUA"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
And I click on "Show more buttons" "button"
When I click on "Strike through" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<strike>MUA</strike>"

View File

@ -0,0 +1,17 @@
@editor @editor_atto @atto @atto_subscript @_bug_phantomjs
Feature: Atto subscript button
To format text in Atto, I need to use the subscript button.
@javascript
Scenario: Subscript some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "Submarine"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
And I click on "Show more buttons" "button"
When I click on "Subscript" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<sub>Submarine</sub>"

View File

@ -0,0 +1,17 @@
@editor @editor_atto @atto @atto_superscript @_bug_phantomjs
Feature: Atto superscript button
To format text in Atto, I need to use the superscript button.
@javascript
Scenario: Subscript some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "Helicopter"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
And I click on "Show more buttons" "button"
When I click on "Superscript" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<sup>Helicopter</sup>"

View File

@ -0,0 +1,40 @@
@editor @editor_atto @atto @atto_table @_bug_phantomjs
Feature: Atto tables
To format text in Atto, I need to create tables
@javascript
Scenario: Create a table
Given I log in as "admin"
And I am on homepage
And I expand "My profile" node
And I expand "Blogs" node
And I follow "Add a new entry"
And I set the field "Entry title" to "How to make a table"
And I set the field "Blog entry body" to "Table test"
And I select the text in the "Blog entry body" Atto editor
And I click on "Show more buttons" "button"
When I click on "Table" "button"
And I set the field "Caption" to "Dinner"
And I press "Create table"
And I press "Save changes"
Then ".blog_entry table caption" "css_element" should be visible
@javascript
Scenario: Edit a table
Given I log in as "admin"
And I am on homepage
And I expand "My profile" node
And I expand "Blogs" node
And I follow "Add a new entry"
And I set the field "Entry title" to "How to make a table"
And I set the field "Blog entry body" to "<table><tr><td>Cell</td></tr></table>"
And I select the text in the "Blog entry body" Atto editor
And I click on "Show more buttons" "button"
And I click on "Table" "button"
And I click on "Edit table" "link"
And I set the field "Caption" to "Dinner"
And I press "Update table"
And I press "Save changes"
Then ".blog_entry table caption" "css_element" should be visible

View File

@ -391,6 +391,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}, this);
}
// Clean the HTML.
this.markUpdated();
},
/**

File diff suppressed because one or more lines are too long

View File

@ -391,6 +391,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}, this);
}
// Clean the HTML.
this.markUpdated();
},
/**

View File

@ -389,6 +389,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
}, this);
}
// Clean the HTML.
this.markUpdated();
},
/**

View File

@ -0,0 +1,17 @@
@editor @editor_atto @atto @atto_title
Feature: Atto title
To format text in Atto, I need to add headings
@javascript
Scenario: Create a heading
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Text editor" to "Plain text area"
And I set the field "Description" to "How The Rock Has Made the WWE World Heavyweight Title More Important Than Ever"
And I select the text in the "Description" Atto editor
When I click on "Paragraph styles" "button"
When I click on "Heading 1" "link"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<h3>How The Rock"

View File

@ -0,0 +1,17 @@
@editor @editor_atto @atto @atto_underline @_bug_phantomjs
Feature: Atto underline button
To format text in Atto, I need to use the underline button.
@javascript
Scenario: Underline some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "Deprecated HTML Tag"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
And I click on "Show more buttons" "button"
When I click on "Underline" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<u>Deprecated HTML Tag</u>"

View File

@ -0,0 +1,16 @@
@editor @editor_atto @atto @atto_unorderedlist @_bug_phantomjs
Feature: Atto unordered list button
To format text in Atto, I need to use the unordered list button.
@javascript
Scenario: Make a list from some text
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I set the field "Description" to "Things, dogs, clogs, they're awesome<br/> Rocks, clocks, and socks, they're awesome<br/> Figs, and wigs, and twigs, that's awesome<br/> Everything you see or think or say is awesome"
And I set the field "Text editor" to "Plain text area"
And I select the text in the "Description" Atto editor
When I click on "Unordered list" "button"
And I press "Update profile"
And I follow "Edit profile"
Then I should see "<ul><li>Things, dogs, clogs"

View File

@ -0,0 +1,62 @@
<?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/>.
/**
* Atto custom steps definitions.
*
* @package editor_atto
* @category test
* @copyright 2014 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
/**
* Steps definitions to deal with the atto text editor
*
* @package editor_atto
* @category test
* @copyright 2014 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_editor_atto extends behat_base {
/**
* Select the text in an Atto field.
*
* @Given /^I select the text in the "([^"]*)" Atto editor$/
* @throws ElementNotFoundException Thrown by behat_base::find
* @param string $field
* @return void
*/
public function select_the_text_in_the_atto_editor($fieldlocator) {
if (!$this->running_javascript()) {
throw new coding_exception('Selecting text requires javascript.');
}
// We delegate to behat_form_field class, it will
// guess the type properly.
$field = behat_field_manager::get_form_field_from_label($fieldlocator, $this);
if (!method_exists($field, 'select_text')) {
throw new coding_exception('Field does not support the select_text function.');
}
$field->select_text();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.