From c4bfba91c2069610c013039a384098d19a42bdde Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Mon, 26 May 2014 20:33:28 +0800 Subject: [PATCH] MDL-44871 Behat: Add tests for Atto functionalities (some of them) --- lib/behat/form_field/behat_form_editor.php | 22 ++++++++ lib/behat/form_field/behat_form_field.php | 7 +++ .../tests/behat/accessibilitychecker.feature | 23 +++++++++ .../tests/behat/accessibilityhelper.feature | 33 ++++++++++++ .../plugins/align/tests/behat/align.feature | 47 ++++++++++++++++++ .../plugins/bold/tests/behat/bold.feature | 31 ++++++++++++ .../charmap/tests/behat/charmap.feature | 18 +++++++ .../moodle-atto_charmap-button-debug.js | 3 ++ .../moodle-atto_charmap-button-min.js | 2 +- .../moodle-atto_charmap-button.js | 3 ++ .../charmap/yui/src/button/js/button.js | 3 ++ .../plugins/clear/tests/behat/clear.feature | 18 +++++++ .../collapse/tests/behat/collapse.feature | 14 ++++++ .../equation/tests/behat/equation.feature | 17 +++++++ .../plugins/html/tests/behat/html.feature | 14 ++++++ .../plugins/image/tests/behat/image.feature | 27 ++++++++++ .../plugins/indent/tests/behat/indent.feature | 32 ++++++++++++ .../plugins/italic/tests/behat/italic.feature | 31 ++++++++++++ .../plugins/link/tests/behat/link.feature | 24 +++++++++ .../moodle-atto_link-button-debug.js | 2 + .../moodle-atto_link-button-min.js | 2 +- .../moodle-atto_link-button.js | 2 + .../plugins/link/yui/src/button/js/button.js | 2 + .../plugins/media/tests/behat/media.feature | 25 ++++++++++ .../tests/behat/orderedlist.feature | 17 +++++++ .../plugins/strike/tests/behat/strike.feature | 18 +++++++ .../subscript/tests/behat/subscript.feature | 18 +++++++ .../tests/behat/superscript.feature | 18 +++++++ .../plugins/table/tests/behat/table.feature | 22 ++++++++ .../plugins/title/tests/behat/title.feature | 18 +++++++ .../underline/tests/behat/underline.feature | 18 +++++++ .../tests/behat/unorderedlist.feature | 17 +++++++ .../atto/tests/fixtures/moodle-logo.png | Bin 0 -> 4640 bytes .../atto/tests/fixtures/moodle-logo.webm | Bin 0 -> 5742 bytes lib/tests/behat/behat_forms.php | 29 +++++++++++ 35 files changed, 575 insertions(+), 2 deletions(-) create mode 100644 lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature create mode 100644 lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature create mode 100644 lib/editor/atto/plugins/align/tests/behat/align.feature create mode 100644 lib/editor/atto/plugins/bold/tests/behat/bold.feature create mode 100644 lib/editor/atto/plugins/charmap/tests/behat/charmap.feature create mode 100644 lib/editor/atto/plugins/clear/tests/behat/clear.feature create mode 100644 lib/editor/atto/plugins/collapse/tests/behat/collapse.feature create mode 100644 lib/editor/atto/plugins/equation/tests/behat/equation.feature create mode 100644 lib/editor/atto/plugins/html/tests/behat/html.feature create mode 100644 lib/editor/atto/plugins/image/tests/behat/image.feature create mode 100644 lib/editor/atto/plugins/indent/tests/behat/indent.feature create mode 100644 lib/editor/atto/plugins/italic/tests/behat/italic.feature create mode 100644 lib/editor/atto/plugins/link/tests/behat/link.feature create mode 100644 lib/editor/atto/plugins/media/tests/behat/media.feature create mode 100644 lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature create mode 100644 lib/editor/atto/plugins/strike/tests/behat/strike.feature create mode 100644 lib/editor/atto/plugins/subscript/tests/behat/subscript.feature create mode 100644 lib/editor/atto/plugins/superscript/tests/behat/superscript.feature create mode 100644 lib/editor/atto/plugins/table/tests/behat/table.feature create mode 100644 lib/editor/atto/plugins/title/tests/behat/title.feature create mode 100644 lib/editor/atto/plugins/underline/tests/behat/underline.feature create mode 100644 lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature create mode 100644 lib/editor/atto/tests/fixtures/moodle-logo.png create mode 100644 lib/editor/atto/tests/fixtures/moodle-logo.webm diff --git a/lib/behat/form_field/behat_form_editor.php b/lib/behat/form_field/behat_form_editor.php index e666b02beb0..e1c9bdfeee6 100644 --- a/lib/behat/form_field/behat_form_editor.php +++ b/lib/behat/form_field/behat_form_editor.php @@ -65,6 +65,28 @@ 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(); + e.focus(); + r.selectNodeContents(e); + s.setSingleRange(r); +}()); '; + $this->session->executeScript($js); + } + /** * Matches the provided value against the current field value. * diff --git a/lib/behat/form_field/behat_form_field.php b/lib/behat/form_field/behat_form_field.php index c1abb1a92a8..6c2392135dc 100644 --- a/lib/behat/form_field/behat_form_field.php +++ b/lib/behat/form_field/behat_form_field.php @@ -236,4 +236,11 @@ class behat_form_field { return $this->fieldlocator; } + /** + * Select all the text in the form field. + * + */ + public function select_text() { + throw new coding_exception('select_text() is not supported for this form field type: ' . get_class($this)); + } } diff --git a/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature b/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature new file mode 100644 index 00000000000..396d9902931 --- /dev/null +++ b/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature @@ -0,0 +1,23 @@ +@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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

Some plain text

Some more text

" + 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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

Hard to read

" + 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." diff --git a/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature new file mode 100644 index 00000000000..f49170f7bf5 --- /dev/null +++ b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature @@ -0,0 +1,33 @@ +@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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

Some plain text

Image 1

Some link text

" + And I select the text in the "Description" field + 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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "Some plain text" + And I click on "Unordered list" "button" + When I click on "Show more buttons" "button" + And I click on "Screenreader helper" "button" + # 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" + diff --git a/lib/editor/atto/plugins/align/tests/behat/align.feature b/lib/editor/atto/plugins/align/tests/behat/align.feature new file mode 100644 index 00000000000..51515a6af6c --- /dev/null +++ b/lib/editor/atto/plugins/align/tests/behat/align.feature @@ -0,0 +1,47 @@ +@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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

Fascism

" + 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" field + 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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

Communism

" + 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" field + 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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

United Future

" + 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" field + When I click on "Center" "button" + And I press "Update profile" + And I follow "Edit profile" + Then I should see "style=\"text-align:center;\"" + diff --git a/lib/editor/atto/plugins/bold/tests/behat/bold.feature b/lib/editor/atto/plugins/bold/tests/behat/bold.feature new file mode 100644 index 00000000000..0a1b49a113e --- /dev/null +++ b/lib/editor/atto/plugins/bold/tests/behat/bold.feature @@ -0,0 +1,31 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + When I click on "Bold" "button" + And I press "Update profile" + And I follow "Edit profile" + Then I should see "Badger" + + @javascript + Scenario: Unbold some text + Given I log in as "admin" + And I follow "Admin User" + And I follow "Edit profile" + 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" field + 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 "Mouse" + And I should see "Mouse" diff --git a/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature new file mode 100644 index 00000000000..c3c43eb16a8 --- /dev/null +++ b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature @@ -0,0 +1,18 @@ +@atto @atto_charmap +Feature: Atto charmap button + To format text in Atto, I need to add symbols + + @javascript + Scenario: Insert synbols + Given I log in as "admin" + And I follow "Admin User" + And I follow "Edit profile" + And I set the field "Text editor" to "Plain text area" + And I set the field "Description" to "1980 Mullet" + 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)1980 Mullet" + diff --git a/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button-debug.js b/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button-debug.js index 1e339575117..a0089aa8c3d 100644 --- a/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button-debug.js +++ b/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button-debug.js @@ -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(); } }); diff --git a/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button-min.js b/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button-min.js index 6ae01e99ad2..33926cdd721 100644 --- a/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button-min.js +++ b/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button-min.js @@ -1,2 +1,2 @@ YUI.add("moodle-atto_charmap-button",function(e,t){var n="atto_charmap",r={BUTTON:"atto_charmap_character",CHARMAP:"atto_charmap_selector"},i=[[" "," ",!0,"nobreakspace"],["&","&",!0,"ampersand"],[""",""",!0,"quotationmark"],["¢","¢",!0,"centsign"],["€","€",!0,"eurosign"],["£","£",!0,"poundsign"],["¥","¥",!0,"yensign"],["©","©",!0,"copyrightsign"],["®","®",!0,"registeredsign"],["™","™",!0,"trademarksign"],["‰","‰",!0,"permillesign"],["µ","µ",!0,"microsign"],["·","·",!0,"middledot"],["•","•",!0,"bullet"],["…","…",!0,"threedotleader"],["′","′",!0,"minutesfeet"],["″","″",!0,"secondsinches"],["§","§",!0,"sectionsign"],["¶","¶",!0,"paragraphsign"],["ß","ß",!0,"sharpsesszed"],["‹","‹",!0,"singleleftpointinganglequotationmark"],["›","›",!0,"singlerightpointinganglequotationmark"],["«","«",!0,"leftpointingguillemet"],["»","»",!0,"rightpointingguillemet"],["‘","‘",!0,"leftsinglequotationmark"],["’","’",!0,"rightsinglequotationmark"],["“","“",!0,"leftdoublequotationmark"],["”","”",!0,"rightdoublequotationmark"],["‚","‚",!0,"singlelow9quotationmark"],["„","„",!0,"doublelow9quotationmark"],["<","<",!0,"lessthansign"],[">",">",!0,"greaterthansign"],["≤","≤",!0,"lessthanorequalto"],["≥","≥",!0,"greaterthanorequalto"],["–","–",!0,"endash"],["—","—",!0,"emdash"],["¯","¯",!0,"macron"],["‾","‾",!0,"overline"],["¤","¤",!0,"currencysign"],["¦","¦",!0,"brokenbar"],["¨","¨",!0,"diaeresis"],["¡","¡",!0,"invertedexclamationmark"],["¿","¿",!0,"turnedquestionmark"],["ˆ","ˆ",!0,"circumflexaccent"],["˜","˜",!0,"smalltilde"],["°","°",!0,"degreesign"],["−","−",!0,"minussign"],["±","±",!0,"plusminussign"],["÷","÷",!0,"divisionsign"],["⁄","⁄",!0,"fractionslash"],["×","×",!0,"multiplicationsign"],["¹","¹",!0,"superscriptone"],["²","²",!0,"superscripttwo"],["³","³",!0,"superscriptthree"],["¼","¼",!0,"fractiononequarter"],["½","½",!0,"fractiononehalf"],["¾","¾",!0,"fractionthreequarters"],["ƒ","ƒ",!0,"functionflorin"],["∫","∫",!0,"integral"],["∑","∑",!0,"narysumation"],["∞","∞",!0,"infinity"],["√","√",!0,"squareroot"],["∼","∼",!1,"similarto"],["≅","≅",!1,"approximatelyequalto"],["≈","≈",!0,"almostequalto"],["≠","≠",!0,"notequalto"],["≡","≡",!0,"identicalto"],["∈","∈",!1,"elementof"],["∉","∉",!1,"notanelementof"],["∋","∋",!1,"containsasmember"],["∏","∏",!0,"naryproduct"],["∧","∧",!1,"logicaland"],["∨","∨",!1,"logicalor"],["¬","¬",!0,"notsign"],["∩","∩",!0,"intersection"],["∪","∪",!1,"union"],["∂","∂",!0,"partialdifferential"],["∀","∀",!1,"forall"],["∃","∃",!1,"thereexists"],["∅","∅",!1,"diameter"],["∇","∇",!1,"backwarddifference"],["∗","∗",!1,"asteriskoperator"],["∝","∝",!1,"proportionalto"],["∠","∠",!1,"angle"],["´","´",!0,"acuteaccent"],["¸","¸",!0,"cedilla"],["ª","ª",!0,"feminineordinalindicator"],["º","º",!0,"masculineordinalindicator"],["†","†",!0,"dagger"],["‡","‡",!0,"doubledagger"],["À","À",!0,"agrave_caps"],["Á","Á",!0,"aacute_caps"],["Â","Â",!0,"acircumflex_caps"],["Ã","Ã",!0,"atilde_caps"],["Ä","Ä",!0,"adiaeresis_caps"],["Å","Å",!0,"aringabove_caps"],["Æ","Æ",!0,"ligatureae_caps"],["Ç","Ç",!0,"ccedilla_caps"],["È","È",!0,"egrave_caps"],["É","É",!0,"eacute_caps"],["Ê","Ê",!0,"ecircumflex_caps"],["Ë","Ë",!0,"ediaeresis_caps"],["Ì","Ì",!0,"igrave_caps"],["Í","Í",!0,"iacute_caps"],["Î","Î",!0,"icircumflex_caps"],["Ï","Ï",!0,"idiaeresis_caps"],["Ð","Ð",!0,"eth_caps"],["Ñ","Ñ",!0,"ntilde_caps"],["Ò","Ò",!0,"ograve_caps"],["Ó","Ó",!0,"oacute_caps"],["Ô","Ô",!0,"ocircumflex_caps"],["Õ","Õ",!0,"otilde_caps"],["Ö","Ö",!0,"odiaeresis_caps"],["Ø","Ø",!0,"oslash_caps"],["Œ","Œ",!0,"ligatureoe_caps"],["Š","Š",!0,"scaron_caps"],["Ù","Ù",!0,"ugrave_caps"],["Ú","Ú",!0,"uacute_caps"],["Û","Û",!0,"ucircumflex_caps"],["Ü","Ü",!0,"udiaeresis_caps"],["Ý","Ý",!0,"yacute_caps"],["Ÿ","Ÿ",!0,"ydiaeresis_caps"],["Þ","Þ",!0,"thorn_caps"],["à","à",!0,"agrave"],["á","á",!0,"aacute"],["â","â",!0,"acircumflex"],["ã","ã",!0,"atilde"],["ä","ä",!0,"adiaeresis"],["å","å",!0,"aringabove"],["æ","æ",!0,"ligatureae"],["ç","ç",!0,"ccedilla"],["è","è",!0,"egrave"],["é","é",!0,"eacute"],["ê","ê",!0,"ecircumflex"],["ë","ë",!0,"ediaeresis"],["ì","ì",!0,"igrave"],["í","í",!0,"iacute"],["î","î",!0,"icircumflex"],["ï","ï",!0,"idiaeresis"],["ð","ð",!0,"eth"],["ñ","ñ",!0,"ntilde"],["ò","ò",!0,"ograve"],["ó","ó",!0,"oacute"],["ô","ô",!0,"ocircumflex"],["õ","õ",!0,"otilde"],["ö","ö",!0,"odiaeresis"],["ø","ø",!0,"oslash"],["œ","œ",!0,"ligatureoe"],["š" -,"š",!0,"scaron"],["ù","ù",!0,"ugrave"],["ú","ú",!0,"uacute"],["û","û",!0,"ucircumflex"],["ü","ü",!0,"udiaeresis"],["ý","ý",!0,"yacute"],["þ","þ",!0,"thorn"],["ÿ","ÿ",!0,"ydiaeresis"],["Α","Α",!0,"alpha_caps"],["Β","Β",!0,"beta_caps"],["Γ","Γ",!0,"gamma_caps"],["Δ","Δ",!0,"delta_caps"],["Ε","Ε",!0,"epsilon_caps"],["Ζ","Ζ",!0,"zeta_caps"],["Η","Η",!0,"eta_caps"],["Θ","Θ",!0,"theta_caps"],["Ι","Ι",!0,"iota_caps"],["Κ","Κ",!0,"kappa_caps"],["Λ","Λ",!0,"lambda_caps"],["Μ","Μ",!0,"mu_caps"],["Ν","Ν",!0,"nu_caps"],["Ξ","Ξ",!0,"xi_caps"],["Ο","Ο",!0,"omicron_caps"],["Π","Π",!0,"pi_caps"],["Ρ","Ρ",!0,"rho_caps"],["Σ","Σ",!0,"sigma_caps"],["Τ","Τ",!0,"tau_caps"],["Υ","Υ",!0,"upsilon_caps"],["Φ","Φ",!0,"phi_caps"],["Χ","Χ",!0,"chi_caps"],["Ψ","Ψ",!0,"psi_caps"],["Ω","Ω",!0,"omega_caps"],["α","α",!0,"alpha"],["β","β",!0,"beta"],["γ","γ",!0,"gamma"],["δ","δ",!0,"delta"],["ε","ε",!0,"epsilon"],["ζ","ζ",!0,"zeta"],["η","η",!0,"eta"],["θ","θ",!0,"theta"],["ι","ι",!0,"iota"],["κ","κ",!0,"kappa"],["λ","λ",!0,"lambda"],["μ","μ",!0,"mu"],["ν","ν",!0,"nu"],["ξ","ξ",!0,"xi"],["ο","ο",!0,"omicron"],["π","π",!0,"pi"],["ρ","ρ",!0,"rho"],["ς","ς",!0,"finalsigma"],["σ","σ",!0,"sigma"],["τ","τ",!0,"tau"],["υ","υ",!0,"upsilon"],["φ","φ",!0,"phi"],["χ","χ",!0,"chi"],["ψ","ψ",!0,"psi"],["ω","ω",!0,"omega"],["ℵ","ℵ",!1,"alefsymbol"],["ϖ","ϖ",!1,"pisymbol"],["ℜ","ℜ",!1,"realpartsymbol"],["ϑ","ϑ",!1,"thetasymbol"],["ϒ","ϒ",!1,"upsilonhooksymbol"],["℘","℘",!1,"weierstrassp"],["ℑ","ℑ",!1,"imaginarypart"],["←","←",!0,"leftwardsarrow"],["↑","↑",!0,"upwardsarrow"],["→","→",!0,"rightwardsarrow"],["↓","↓",!0,"downwardsarrow"],["↔","↔",!0,"leftrightarrow"],["↵","↵",!1,"carriagereturn"],["⇐","⇐",!1,"leftwardsdoublearrow"],["⇑","⇑",!1,"upwardsdoublearrow"],["⇒","⇒",!1,"rightwardsdoublearrow"],["⇓","⇓",!1,"downwardsdoublearrow"],["⇔","⇔",!1,"leftrightdoublearrow"],["∴","∴",!1,"therefore"],["⊂","⊂",!1,"subsetof"],["⊃","⊃",!1,"supersetof"],["⊄","⊄",!1,"notasubsetof"],["⊆","⊆",!1,"subsetoforequalto"],["⊇","⊇",!1,"supersetoforequalto"],["⊕","⊕",!1,"circledplus"],["⊗","⊗",!1,"circledtimes"],["⊥","⊥",!1,"perpendicular"],["⋅","⋅",!1,"dotoperator"],["⌈","⌈",!1,"leftceiling"],["⌉","⌉",!1,"rightceiling"],["⌊","⌊",!1,"leftfloor"],["⌋","⌋",!1,"rightfloor"],["⟨","〈",!1,"leftpointinganglebracket"],["⟩","〉",!1,"rightpointinganglebracket"],["◊","◊",!0,"lozenge"],["♠","♠",!0,"blackspadesuit"],["♣","♣",!0,"blackclubsuit"],["♥","♥",!0,"blackheartsuit"],["♦","♦",!0,"blackdiamondsuit"],[" "," ",!1,"enspace"],[" "," ",!1,"emspace"],[" "," ",!1,"thinspace"],["‌","‌",!1,"zerowidthnonjoiner"],["‍","‍",!1,"zerowidthjoiner"],["‎","‎",!1,"lefttorightmark"],["‏","‏",!1,"righttoleftmark"],["­","­",!1,"softhyphen"]];e.namespace("M.atto_charmap").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,initializer:function(){this.addButton({icon:"e/special_character",callback:this._displayDialogue})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var e=this.getDialogue({headerContent:M.util.get_string("insertcharacter",n),focusAfterHide:!0},!0);e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Handlebars.compile('
{{#each CHARMAP}}{{#if this.[2]}}{{/if}}{{/each}}
'),s=e.Node.create(t({component:n,CSS:r,CHARMAP:i}));return s.delegate("click",this._insertChar,"."+r.BUTTON,this),s},_insertChar:function(e){var t=e.target.getData("character");this.getDialogue({focusAfterHide:null}).hide();var n=this.get("host");n.setSelection(this._currentSelection),n.insertContentAtFocusPoint(t)}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); +,"š",!0,"scaron"],["ù","ù",!0,"ugrave"],["ú","ú",!0,"uacute"],["û","û",!0,"ucircumflex"],["ü","ü",!0,"udiaeresis"],["ý","ý",!0,"yacute"],["þ","þ",!0,"thorn"],["ÿ","ÿ",!0,"ydiaeresis"],["Α","Α",!0,"alpha_caps"],["Β","Β",!0,"beta_caps"],["Γ","Γ",!0,"gamma_caps"],["Δ","Δ",!0,"delta_caps"],["Ε","Ε",!0,"epsilon_caps"],["Ζ","Ζ",!0,"zeta_caps"],["Η","Η",!0,"eta_caps"],["Θ","Θ",!0,"theta_caps"],["Ι","Ι",!0,"iota_caps"],["Κ","Κ",!0,"kappa_caps"],["Λ","Λ",!0,"lambda_caps"],["Μ","Μ",!0,"mu_caps"],["Ν","Ν",!0,"nu_caps"],["Ξ","Ξ",!0,"xi_caps"],["Ο","Ο",!0,"omicron_caps"],["Π","Π",!0,"pi_caps"],["Ρ","Ρ",!0,"rho_caps"],["Σ","Σ",!0,"sigma_caps"],["Τ","Τ",!0,"tau_caps"],["Υ","Υ",!0,"upsilon_caps"],["Φ","Φ",!0,"phi_caps"],["Χ","Χ",!0,"chi_caps"],["Ψ","Ψ",!0,"psi_caps"],["Ω","Ω",!0,"omega_caps"],["α","α",!0,"alpha"],["β","β",!0,"beta"],["γ","γ",!0,"gamma"],["δ","δ",!0,"delta"],["ε","ε",!0,"epsilon"],["ζ","ζ",!0,"zeta"],["η","η",!0,"eta"],["θ","θ",!0,"theta"],["ι","ι",!0,"iota"],["κ","κ",!0,"kappa"],["λ","λ",!0,"lambda"],["μ","μ",!0,"mu"],["ν","ν",!0,"nu"],["ξ","ξ",!0,"xi"],["ο","ο",!0,"omicron"],["π","π",!0,"pi"],["ρ","ρ",!0,"rho"],["ς","ς",!0,"finalsigma"],["σ","σ",!0,"sigma"],["τ","τ",!0,"tau"],["υ","υ",!0,"upsilon"],["φ","φ",!0,"phi"],["χ","χ",!0,"chi"],["ψ","ψ",!0,"psi"],["ω","ω",!0,"omega"],["ℵ","ℵ",!1,"alefsymbol"],["ϖ","ϖ",!1,"pisymbol"],["ℜ","ℜ",!1,"realpartsymbol"],["ϑ","ϑ",!1,"thetasymbol"],["ϒ","ϒ",!1,"upsilonhooksymbol"],["℘","℘",!1,"weierstrassp"],["ℑ","ℑ",!1,"imaginarypart"],["←","←",!0,"leftwardsarrow"],["↑","↑",!0,"upwardsarrow"],["→","→",!0,"rightwardsarrow"],["↓","↓",!0,"downwardsarrow"],["↔","↔",!0,"leftrightarrow"],["↵","↵",!1,"carriagereturn"],["⇐","⇐",!1,"leftwardsdoublearrow"],["⇑","⇑",!1,"upwardsdoublearrow"],["⇒","⇒",!1,"rightwardsdoublearrow"],["⇓","⇓",!1,"downwardsdoublearrow"],["⇔","⇔",!1,"leftrightdoublearrow"],["∴","∴",!1,"therefore"],["⊂","⊂",!1,"subsetof"],["⊃","⊃",!1,"supersetof"],["⊄","⊄",!1,"notasubsetof"],["⊆","⊆",!1,"subsetoforequalto"],["⊇","⊇",!1,"supersetoforequalto"],["⊕","⊕",!1,"circledplus"],["⊗","⊗",!1,"circledtimes"],["⊥","⊥",!1,"perpendicular"],["⋅","⋅",!1,"dotoperator"],["⌈","⌈",!1,"leftceiling"],["⌉","⌉",!1,"rightceiling"],["⌊","⌊",!1,"leftfloor"],["⌋","⌋",!1,"rightfloor"],["⟨","〈",!1,"leftpointinganglebracket"],["⟩","〉",!1,"rightpointinganglebracket"],["◊","◊",!0,"lozenge"],["♠","♠",!0,"blackspadesuit"],["♣","♣",!0,"blackclubsuit"],["♥","♥",!0,"blackheartsuit"],["♦","♦",!0,"blackdiamondsuit"],[" "," ",!1,"enspace"],[" "," ",!1,"emspace"],[" "," ",!1,"thinspace"],["‌","‌",!1,"zerowidthnonjoiner"],["‍","‍",!1,"zerowidthjoiner"],["‎","‎",!1,"lefttorightmark"],["‏","‏",!1,"righttoleftmark"],["­","­",!1,"softhyphen"]];e.namespace("M.atto_charmap").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,initializer:function(){this.addButton({icon:"e/special_character",callback:this._displayDialogue})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var e=this.getDialogue({headerContent:M.util.get_string("insertcharacter",n),focusAfterHide:!0},!0);e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Handlebars.compile('
{{#each CHARMAP}}{{#if this.[2]}}{{/if}}{{/each}}
'),s=e.Node.create(t({component:n,CSS:r,CHARMAP:i}));return s.delegate("click",this._insertChar,"."+r.BUTTON,this),s},_insertChar:function(e){var t=e.target.getData("character");this.getDialogue({focusAfterHide:null}).hide();var n=this.get("host");n.setSelection(this._currentSelection),n.insertContentAtFocusPoint(t),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button.js b/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button.js index 1e339575117..a0089aa8c3d 100644 --- a/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button.js +++ b/lib/editor/atto/plugins/charmap/yui/build/moodle-atto_charmap-button/moodle-atto_charmap-button.js @@ -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(); } }); diff --git a/lib/editor/atto/plugins/charmap/yui/src/button/js/button.js b/lib/editor/atto/plugins/charmap/yui/src/button/js/button.js index f777e3b0ce8..571ad63b6fa 100644 --- a/lib/editor/atto/plugins/charmap/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/charmap/yui/src/button/js/button.js @@ -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(); } }); diff --git a/lib/editor/atto/plugins/clear/tests/behat/clear.feature b/lib/editor/atto/plugins/clear/tests/behat/clear.feature new file mode 100644 index 00000000000..82ca1cf2f8b --- /dev/null +++ b/lib/editor/atto/plugins/clear/tests/behat/clear.feature @@ -0,0 +1,18 @@ +@atto @atto_clear +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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Text editor" to "Plain text area" + And I set the field "Description" to "

Pisa

" + When I click on "Show more buttons" "button" + And I select the text in the "Description" field + And I click on "Clear formatting" "button" + And I press "Update profile" + And I follow "Edit profile" + Then I should not see "Pisa" + diff --git a/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature b/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature new file mode 100644 index 00000000000..ed2a87e2ae9 --- /dev/null +++ b/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature @@ -0,0 +1,14 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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 + diff --git a/lib/editor/atto/plugins/equation/tests/behat/equation.feature b/lib/editor/atto/plugins/equation/tests/behat/equation.feature new file mode 100644 index 00000000000..3832172773a --- /dev/null +++ b/lib/editor/atto/plugins/equation/tests/behat/equation.feature @@ -0,0 +1,17 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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 + diff --git a/lib/editor/atto/plugins/html/tests/behat/html.feature b/lib/editor/atto/plugins/html/tests/behat/html.feature new file mode 100644 index 00000000000..735a8215be1 --- /dev/null +++ b/lib/editor/atto/plugins/html/tests/behat/html.feature @@ -0,0 +1,14 @@ +@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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

Smurf

" + And I click on "Show more buttons" "button" + And I click on "HTML" "button" + Then the field "Description" matches value "

Smurf

" + diff --git a/lib/editor/atto/plugins/image/tests/behat/image.feature b/lib/editor/atto/plugins/image/tests/behat/image.feature new file mode 100644 index 00000000000..4936a9ca9ba --- /dev/null +++ b/lib/editor/atto/plugins/image/tests/behat/image.feature @@ -0,0 +1,27 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + And I click on "Image" "button" + Then the field "Describe this image" matches value "It's the Moodle" + diff --git a/lib/editor/atto/plugins/indent/tests/behat/indent.feature b/lib/editor/atto/plugins/indent/tests/behat/indent.feature new file mode 100644 index 00000000000..5106de839cd --- /dev/null +++ b/lib/editor/atto/plugins/indent/tests/behat/indent.feature @@ -0,0 +1,32 @@ +@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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

I need some space.

" + And I set the field "Text editor" to "Plain text area" + And I select the text in the "Description" field + 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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "

I need some space.

" + And I set the field "Text editor" to "Plain text area" + And I select the text in the "Description" field + 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\"" diff --git a/lib/editor/atto/plugins/italic/tests/behat/italic.feature b/lib/editor/atto/plugins/italic/tests/behat/italic.feature new file mode 100644 index 00000000000..a582132a362 --- /dev/null +++ b/lib/editor/atto/plugins/italic/tests/behat/italic.feature @@ -0,0 +1,31 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + When I click on "Italic" "button" + And I press "Update profile" + And I follow "Edit profile" + Then I should see "Tower of Pisa" + + @javascript + Scenario: Toggle italics in some text + Given I log in as "admin" + And I follow "Admin User" + And I follow "Edit profile" + 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" field + 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 "GHD - for hair" + And I should see "GHD - for hair" diff --git a/lib/editor/atto/plugins/link/tests/behat/link.feature b/lib/editor/atto/plugins/link/tests/behat/link.feature new file mode 100644 index 00000000000..00a1e05d457 --- /dev/null +++ b/lib/editor/atto/plugins/link/tests/behat/link.feature @@ -0,0 +1,24 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + 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" + diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js index 851d7401141..72a694ae0cc 100644 --- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js +++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js @@ -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(); } }, diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js index 8b51ba95772..bcdefd1f0fc 100644 --- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js +++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js @@ -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='

{{#if showFilepicker}}
{{/if}}

';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='

{{#if showFilepicker}}
{{/if}}

';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"]}); diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js index 851d7401141..72a694ae0cc 100644 --- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js +++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js @@ -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(); } }, diff --git a/lib/editor/atto/plugins/link/yui/src/button/js/button.js b/lib/editor/atto/plugins/link/yui/src/button/js/button.js index 5f66ca2254f..c78379e690f 100644 --- a/lib/editor/atto/plugins/link/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/link/yui/src/button/js/button.js @@ -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(); } }, diff --git a/lib/editor/atto/plugins/media/tests/behat/media.feature b/lib/editor/atto/plugins/media/tests/behat/media.feature new file mode 100644 index 00000000000..324af57e194 --- /dev/null +++ b/lib/editor/atto/plugins/media/tests/behat/media.feature @@ -0,0 +1,25 @@ +@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 "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 + diff --git a/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature b/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature new file mode 100644 index 00000000000..8b85d903ca4 --- /dev/null +++ b/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature @@ -0,0 +1,17 @@ +@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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "Have you heard the news everyone's talking
Life is good 'cause everything's awesome
" + And I set the field "Text editor" to "Plain text area" + And I select the text in the "Description" field + When I click on "Ordered list" "button" + And I press "Update profile" + And I follow "Edit profile" + Then I should see "
  1. Have you heard the news everyone's talking" + diff --git a/lib/editor/atto/plugins/strike/tests/behat/strike.feature b/lib/editor/atto/plugins/strike/tests/behat/strike.feature new file mode 100644 index 00000000000..7eac7b50f99 --- /dev/null +++ b/lib/editor/atto/plugins/strike/tests/behat/strike.feature @@ -0,0 +1,18 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + 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 "MUA" + diff --git a/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature b/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature new file mode 100644 index 00000000000..c918ad65986 --- /dev/null +++ b/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature @@ -0,0 +1,18 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + 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 "Submarine" + diff --git a/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature b/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature new file mode 100644 index 00000000000..ed3e0c9a497 --- /dev/null +++ b/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature @@ -0,0 +1,18 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + 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 "Helicopter" + diff --git a/lib/editor/atto/plugins/table/tests/behat/table.feature b/lib/editor/atto/plugins/table/tests/behat/table.feature new file mode 100644 index 00000000000..4ae262bfac3 --- /dev/null +++ b/lib/editor/atto/plugins/table/tests/behat/table.feature @@ -0,0 +1,22 @@ +@atto @atto_table +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 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 select the text in the "Blog entry body" field + And I click on "Table" "button" + And I click on "Insert column after" "link" + And I press "Save changes" + Then ".blog_entry table caption" "css_element" should be visible + diff --git a/lib/editor/atto/plugins/title/tests/behat/title.feature b/lib/editor/atto/plugins/title/tests/behat/title.feature new file mode 100644 index 00000000000..900f0da222a --- /dev/null +++ b/lib/editor/atto/plugins/title/tests/behat/title.feature @@ -0,0 +1,18 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + 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 "

    How The Rock" + diff --git a/lib/editor/atto/plugins/underline/tests/behat/underline.feature b/lib/editor/atto/plugins/underline/tests/behat/underline.feature new file mode 100644 index 00000000000..ffc56a751c6 --- /dev/null +++ b/lib/editor/atto/plugins/underline/tests/behat/underline.feature @@ -0,0 +1,18 @@ +@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 follow "Admin User" + And I follow "Edit profile" + 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" field + 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 "Deprecated HTML Tag" + diff --git a/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature b/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature new file mode 100644 index 00000000000..f148bb9dfc9 --- /dev/null +++ b/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature @@ -0,0 +1,17 @@ +@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 follow "Admin User" + And I follow "Edit profile" + And I set the field "Description" to "Things, dogs, clogs, they're awesome
    Rocks, clocks, and socks, they're awesome
    Figs, and wigs, and twigs, that's awesome
    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" field + When I click on "Unordered list" "button" + And I press "Update profile" + And I follow "Edit profile" + Then I should see "
    • Things, dogs, clogs" + diff --git a/lib/editor/atto/tests/fixtures/moodle-logo.png b/lib/editor/atto/tests/fixtures/moodle-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..efed023611dd91ef6967cf21b4205bf9ef13fd66 GIT binary patch literal 4640 zcmV+*65s8KP)^ma0vMW=fj^t!!f1k|k}wy*tVGzCAq>$G&goeDd9CcW?Lm?f1Bc zFd+n4Vo5b*YR?*8nMmnRX(fCfZo2z;fIIf_)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0uP!~7db!x$FB!RJ>HI`+srze_ z={K5_6sB%?}Q#b|3XI!V!r%&`esWrIx?^N_{n0OG9E@rNI9A?^+an7F9Sd6P~T_FaJ;AG zEMD(@Rs=#T<{*iOKwboY&BXWxqCFM=re6ssCtT7n=WWu7^(#p1My2U%!Cww1o_inn zX306QdUK7QBSOr>y3_YNUk2ht+S)ly$bhAgw#d+W9WtVC^(FpR%IAfiGq;$Sgc2V6 zkhM7#QjD@cd3XU#r?8{e*5cv1)NyCXvY|7lT}cb1byu!5l1nV=uvZ{;sz?DOX0vtQ zq9E9$eS8dro=1|^fQBJ|5@Z7L&^l(RaTQ2V Ob@VS+`9~Po=idO8ZlC1< literal 0 HcmV?d00001 diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index b686efbdc6d..a0af7f7031c 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -155,6 +155,18 @@ class behat_forms extends behat_base { $this->set_field_value($field, $value); } + /** + * Select all the text in a field. + * + * @Given /^I select the text in the "([^"]*)" field$/ + * @throws ElementNotFoundException Thrown by behat_base::find + * @param string $field + * @return void + */ + public function i_select_the_text_in_the_field($field) { + $this->select_text($field); + } + /** * Checks, the field matches the value. More info in http://docs.moodle.org/dev/Acceptance_testing#Providing_values_to_steps. * @@ -332,6 +344,23 @@ class behat_forms extends behat_base { } } + /** + * Call select_text on the field. + * + * Internal API method, a generic *I select the text in the "FIELD" field* + * is based on it. + * + * @param string $fieldlocator The pointer to the field, it will depend on the field type. + * @return void + */ + protected function select_text($fieldlocator) { + + // We delegate to behat_form_field class, it will + // guess the type properly. + $field = behat_field_manager::get_form_field_from_label($fieldlocator, $this); + $field->select_text(); + } + /** * Generic field setter. *