From c4bfba91c2069610c013039a384098d19a42bdde Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Mon, 26 May 2014 20:33:28 +0800 Subject: [PATCH 1/6] 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;fI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G0I^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. * From bbd644ea3409d2f2a2f8673df4b4abb3b65b4638 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 11 Jun 2014 12:39:57 +0800 Subject: [PATCH 2/6] MDL-44871 Atto behat tests: Modified the tests to work around focus bugs with workspaces The main changes here are that the "select the text in" step was modified to select only the first text node in the editor field, and to focus on it's parent instead of the entire editable div. Some tests had to be modified to match the new behaviour, and another "real" bug was found in the table plugin. --- lib/behat/form_field/behat_form_editor.php | 4 +++ .../tests/behat/accessibilityhelper.feature | 6 +++-- .../charmap/tests/behat/charmap.feature | 7 ++--- .../plugins/clear/tests/behat/clear.feature | 2 +- .../equation/tests/behat/equation.feature | 2 ++ .../plugins/image/tests/behat/image.feature | 2 ++ .../plugins/media/tests/behat/media.feature | 2 ++ .../plugins/table/tests/behat/table.feature | 26 ++++++++++++++++--- .../moodle-atto_table-button-debug.js | 2 ++ .../moodle-atto_table-button-min.js | 6 ++--- .../moodle-atto_table-button.js | 2 ++ .../plugins/table/yui/src/button/js/button.js | 2 ++ 12 files changed, 50 insertions(+), 13 deletions(-) diff --git a/lib/behat/form_field/behat_form_editor.php b/lib/behat/form_field/behat_form_editor.php index e1c9bdfeee6..8f3ff721d5d 100644 --- a/lib/behat/form_field/behat_form_editor.php +++ b/lib/behat/form_field/behat_form_editor.php @@ -80,6 +80,10 @@ editor.set("value", "' . $value . '"); 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); diff --git a/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature index f49170f7bf5..3762a17b764 100644 --- a/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature +++ b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature @@ -23,10 +23,12 @@ Feature: Atto accessibility helper 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" + And I set the field "Description" to "

      Some plain text

      " When I click on "Show more buttons" "button" + And I select the text in the "Description" field + And I click on "Unordered list" "button" And I click on "Screenreader helper" "button" + And I select the text in the "Description" field # 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/charmap/tests/behat/charmap.feature b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature index c3c43eb16a8..eb5828ff87e 100644 --- a/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature +++ b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature @@ -3,16 +3,17 @@ Feature: Atto charmap button To format text in Atto, I need to add symbols @javascript - Scenario: Insert synbols + Scenario: Insert symbols 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" + And I set the field "Description" to "

      1980 Mullet

      " + And I select the text in the "Description" field 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" + Then I should see "(c)" diff --git a/lib/editor/atto/plugins/clear/tests/behat/clear.feature b/lib/editor/atto/plugins/clear/tests/behat/clear.feature index 82ca1cf2f8b..59e38f90bff 100644 --- a/lib/editor/atto/plugins/clear/tests/behat/clear.feature +++ b/lib/editor/atto/plugins/clear/tests/behat/clear.feature @@ -1,4 +1,4 @@ -@atto @atto_clear +@atto @atto_clear @_bug_phantomjs Feature: Atto clear button To format text in Atto, I need to remove formatting diff --git a/lib/editor/atto/plugins/equation/tests/behat/equation.feature b/lib/editor/atto/plugins/equation/tests/behat/equation.feature index 3832172773a..31474091f1e 100644 --- a/lib/editor/atto/plugins/equation/tests/behat/equation.feature +++ b/lib/editor/atto/plugins/equation/tests/behat/equation.feature @@ -7,6 +7,8 @@ Feature: Atto equation editor Given I log in as "admin" When I follow "Admin User" And I follow "Edit profile" + And I set the field "Description" to "

      Equation test

      " + And I select the text in the "Description" field 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" diff --git a/lib/editor/atto/plugins/image/tests/behat/image.feature b/lib/editor/atto/plugins/image/tests/behat/image.feature index 4936a9ca9ba..566cc441863 100644 --- a/lib/editor/atto/plugins/image/tests/behat/image.feature +++ b/lib/editor/atto/plugins/image/tests/behat/image.feature @@ -10,6 +10,8 @@ Feature: Add images to Atto And I click on "Save changes" "button" When I follow "Admin User" And I follow "Edit profile" + And I set the field "Description" to "

      Image test

      " + And I select the text in the "Description" field And I click on "Image" "button" And I click on "Browse repositories..." "button" And I click on "Private files" "link" diff --git a/lib/editor/atto/plugins/media/tests/behat/media.feature b/lib/editor/atto/plugins/media/tests/behat/media.feature index 324af57e194..a8eff24ec76 100644 --- a/lib/editor/atto/plugins/media/tests/behat/media.feature +++ b/lib/editor/atto/plugins/media/tests/behat/media.feature @@ -12,6 +12,8 @@ Feature: Add media to Atto 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 "

      Media test

      " + And I select the text in the "Blog entry body" field 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" diff --git a/lib/editor/atto/plugins/table/tests/behat/table.feature b/lib/editor/atto/plugins/table/tests/behat/table.feature index 4ae262bfac3..8b79bcb393b 100644 --- a/lib/editor/atto/plugins/table/tests/behat/table.feature +++ b/lib/editor/atto/plugins/table/tests/behat/table.feature @@ -1,4 +1,4 @@ -@atto @atto_table +@atto @atto_table @_bug_phantomjs Feature: Atto tables To format text in Atto, I need to create tables @@ -10,13 +10,31 @@ Feature: Atto tables 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" field 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 + @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 "
      Cell
      " + And I select the text in the "Blog entry body" field + 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 + + diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js index 221375f65e8..cd32dee7fee 100644 --- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js +++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js @@ -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(); }, /** diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js index d1757003604..42b55786277 100644 --- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js +++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js @@ -1,3 +1,3 @@ -YUI.add("moodle-atto_table-button",function(e,t){var n="atto_table",r='




      ',i='






      ',s={CAPTION:"caption",HEADERS:"headers",ROWS:"rows",COLUMNS:"columns",SUBMIT:"submit",FORM:"atto_form"},o={CAPTION:"."+s.CAPTION,HEADERS:"."+s.HEADERS,ROWS:"."+s.ROWS,COLUMNS:"."+s.COLUMNS,SUBMIT:"."+s.SUBMIT,FORM:".atto_form"};e.namespace("M.atto_table").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_contextMenu:null,_lastTarget:null,_menuOptions:null,initializer:function(){this.addButton({icon:"e/table",callback:this._displayTableEditor,tags:"table"}),e.UA.gecko&&(document.execCommand("enableInlineTableEditing",!1,!1),document.execCommand("enableObjectResizing",!1,!1))},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection!==!1&&!this._currentSelection.collapsed){var e=this.getDialogue({headerContent:M.util.get_string("createtable",n),focusAfterHide:!0,focusOnShowSelector:o.CAPTION});e.set("bodyContent",this._getDialogueContent()).show()}},_displayTableEditor:function(e){var t=this._getSuitableTableCell();return t?(e.tableCell=t,this._showTableMenu(e)):this._displayDialogue(e)},_stopAtContentEditableFilter:function(e){this.editor.contains(e)},_getEditDialogueContent:function(){var t=e.Handlebars.compile(r);return this._content=e.Node.create(t({CSS:s,elementid:this.get("host").get("elementid"),component:n})),this._content.one(".submit").on("click",this._updateTable,this),this._content},_getDialogueContent:function(){var t=e.Handlebars.compile(i);return this._content=e.Node.create(t({CSS:s,elementid:this.get("host").get("elementid"),component:n})),this._content.one(".submit").on("click",this._setTable,this),this._content},_getSuitableTableCell:function(){var e=null,t=this.get("host");t.getSelectedNodes().some(function(t){if(t.ancestor("td, th, caption",!0,this._stopAtContentEditableFilter)){e=t;var n=t.ancestor("caption",!0,this._stopAtContentEditableFilter);if(n){var r=n.get("parentNode");r&&(e=r.one("td, th"))}return!0}});if(e){var n=t.getSelectionFromNode(e);t.setSelection(n)}return e},_changeNodeType:function(t,n){var r=e.Node.create("<"+n+">");return r.setAttrs(t.getAttrs()),t.get("childNodes").each(function(e){r.append(e.remove())}),t.replace(r),r},_updateTable:function(t){var n,r,i,s;t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=t.currentTarget.ancestor(o.FORM).one(o.CAPTION),r=t.currentTarget.ancestor(o.FORM).one(o.HEADERS),i=this._lastTarget.ancestor("table"),s=i.one("caption"),s||(s=e.Node.create(""+l,u+=""+e.Escape.html(n.get("value"))+""+l,a=0;if(s.get("value")==="columns"||s.get("value")==="both"){a=1,u+=""+l+""+l;for(f=0;f'+l;u+=""+l+""+l}u+=""+l;for(;a"+l:u+=''+l;u+=""+l}u+=""+l,u+=""+l+"
      ",this.get("host").insertContentAtFocusPoint(u),this.markUpdated()},_findColumnCells:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=new e.NodeList,s=new e.NodeList;return n.each(function(e){var n=e.all("td, th"),o=n.item(t),u=n.item(t-1),a=n.item(t+1);r.push(o),u&&i.push(u),a&&s.push(a)}),{current:r,prev:i,next:s}},_hideInvalidEntries:function(e){var t=this._lastTarget.ancestor("table"),n=this._lastTarget.ancestor("tr"),r=t.all("tr"),i=r.indexOf(n),s=r.item(i-1),o=s?s.one("td"):null;!n||!o?e.one('[data-change="moverowup"]').hide():e.one('[data-change="moverowup"]').show();var u=r.item(i+1),a=n?n.one("td"):!1;!n||!u||!a?e.one('[data-change="moverowdown"]').hide():e.one('[data-change="moverowdown"]').show();var f=this._findColumnCells();f.prev.filter("td").size()>0?e.one('[data-change="movecolumnleft"]').show():e.one('[data-change="movecolumnleft"]').hide();var l=f.current.filter("td").size()>0;f.next.size()>0&&l?e.one('[data-change="movecolumnright"]').show():e.one('[data-change="movecolumnright"]').hide(),f.current.filter("td").size()>0?e.one('[data-change="deletecolumn"]').show():e.one('[data-change="deletecolumn"]').hide(),!n||!n.one("td")?e.one('[data-change="deleterow"]').hide():e.one('[data-change="deleterow"]').show()},_showTableMenu:function(t){t.preventDefault();var r;this._contextMenu||(this._menuOptions=[{text:M.util.get_string("addcolumnafter",n),data:{change:"addcolumnafter"}},{text:M.util.get_string("addrowafter",n),data:{change:"addrowafter"}},{text:M.util.get_string("moverowup",n),data:{change:"moverowup"}},{text:M.util.get_string("moverowdown",n),data:{change:"moverowdown"}},{text:M.util.get_string("movecolumnleft",n),data:{change:"movecolumnleft"}},{text:M.util.get_string("movecolumnright",n),data:{change:"movecolumnright"}},{text:M.util.get_string("deleterow",n),data:{change:"deleterow"}},{text:M.util.get_string("deletecolumn",n),data:{change:"deletecolumn"}},{text:M.util.get_string("edittable",n),data:{change:"edittable"}}],this._contextMenu=new e.M.editor_atto.Menu({items:this._menuOptions}),r=this._contextMenu.get("boundingBox"),r.delegate("click",this._handleTableChange,"a",this)),r=this._contextMenu.get("boundingBox"),this._lastTarget=t.tableCell.ancestor(".editor_atto_content td, .editor_atto_content th",!0),this._hideInvalidEntries(r),e.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)});var i=this.buttons[this.name];this.get("host")._setTabFocus(i),this._contextMenu.show(),this._contextMenu.align(this.buttons.table,[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),this._contextMenu.set("focusAfterHide",i),r.one("a")&&r.one("a").focus(),this.get("host").openMenus=[this._contextMenu]},_handleTableChange:function(e){e.preventDefault(),this._contextMenu.set("focusAfterHide",this.get("host").editor),this._contextMenu.hide(e);switch(e.target.getData("change")){case"addcolumnafter":this._addColumnAfter();break;case"addrowafter":this._addRowAfter();break;case"deleterow":this._deleteRow();break;case"deletecolumn":this._deleteColumn();break;case"edittable":this._editTable();break;case"moverowdown":this._moveRowDown();break;case"moverowup":this._moveRowUp();break;case"movecolumnleft":this._moveColumnLeft();break;case"movecolumnright":this._moveColumnRight()}},_getRowIndex:function(e){var t=e.ancestor("table"),n=e.ancestor("tr");if(!t||!n)return;var r=t.all("tr");return r.indexOf(n)},_getColumnIndex:function(e){var t=e.ancestor("tr");if(!t)return;var n=t.all("td, th");return n.indexOf(e)},_deleteRow:function(){var e=this._lastTarget.ancestor("tr");e&&e.one("td")&&e.remove(!0),this.markUpdated()},_moveRowUp:function(){var e=this._lastTarget.ancestor("tr"),t=e.previous("tr");if(!e||!t)return;e.swap(t),this.markUpdated()},_moveColumnLeft:function(){var e=this._findColumnCells();if(e.current.size()>0&&e.prev.size()>0&&e.current.size()===e.prev.size()){var t=0;for(t=0;t "),1)},_removeCaption:function(){var e=this._lastTarget.ancestor("table"),t=e.one("caption");t&&t.remove(!0)},_moveColumnRight:function(){var e=this._findColumnCells();if(e.next.size()>0&&e.current.size()===e.next.size()&&e.current.filter("td").size()>0){var t=0;for(t=0;t");t.replace(n),t=n}t.setHTML(" ")}),n.insert(newrow,t),this.markUpdated()},_addColumnAfter:function(){var t=this._findColumnCells(),n=!0,r=t.next;t.next.size()<=0&&(n=!1,r=t.current),e.each(r,function(e){var t=e.cloneNode();t.setHTML(" "),n?e.get("parentNode").insert(t,e):(e.get("parentNode").insert(t,e),e.swap(t))},this),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-editor_atto-menu","event","event-valuechange"]}); +YUI.add("moodle-atto_table-button",function(e,t){var n="atto_table",r='




      ',i='






      ',s={CAPTION:"caption",HEADERS:"headers",ROWS:"rows",COLUMNS:"columns",SUBMIT:"submit",FORM:"atto_form"},o={CAPTION:"."+s.CAPTION,HEADERS:"."+s.HEADERS,ROWS:"."+s.ROWS,COLUMNS:"."+s.COLUMNS,SUBMIT:"."+s.SUBMIT,FORM:".atto_form"};e.namespace("M.atto_table").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_contextMenu:null,_lastTarget:null,_menuOptions:null,initializer:function(){this.addButton({icon:"e/table",callback:this._displayTableEditor,tags:"table"}),e.UA.gecko&&(document.execCommand("enableInlineTableEditing",!1,!1),document.execCommand("enableObjectResizing",!1,!1))},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection!==!1&&!this._currentSelection.collapsed){var e=this.getDialogue({headerContent:M.util.get_string("createtable",n),focusAfterHide:!0,focusOnShowSelector:o.CAPTION});e.set("bodyContent",this._getDialogueContent()).show()}},_displayTableEditor:function(e){var t=this._getSuitableTableCell();return t?(e.tableCell=t,this._showTableMenu(e)):this._displayDialogue(e)},_stopAtContentEditableFilter:function(e){this.editor.contains(e)},_getEditDialogueContent:function(){var t=e.Handlebars.compile(r);return this._content=e.Node.create(t({CSS:s,elementid:this.get("host").get("elementid"),component:n})),this._content.one(".submit").on("click",this._updateTable,this),this._content},_getDialogueContent:function(){var t=e.Handlebars.compile(i);return this._content=e.Node.create(t({CSS:s,elementid:this.get("host").get("elementid"),component:n})),this._content.one(".submit").on("click",this._setTable,this),this._content},_getSuitableTableCell:function(){var e=null,t=this.get("host");t.getSelectedNodes().some(function(t){if(t.ancestor("td, th, caption",!0,this._stopAtContentEditableFilter)){e=t;var n=t.ancestor("caption",!0,this._stopAtContentEditableFilter);if(n){var r=n.get("parentNode");r&&(e=r.one("td, th"))}return!0}});if(e){var n=t.getSelectionFromNode(e);t.setSelection(n)}return e},_changeNodeType:function(t,n){var r=e.Node.create("<"+n+">");return r.setAttrs(t.getAttrs()),t.get("childNodes").each(function(e){r.append(e.remove())}),t.replace(r),r},_updateTable:function(t){var n,r,i,s;t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=t.currentTarget.ancestor(o.FORM).one(o.CAPTION),r=t.currentTarget.ancestor(o.FORM).one(o.HEADERS),i=this._lastTarget.ancestor("table"),s=i.one("caption"),s||(s=e.Node.create(""+l,u+=""+e.Escape.html(n.get("value"))+""+l,a=0;if(s.get("value")==="columns"||s.get("value")==="both"){a=1,u+=""+l+""+l;for(f=0;f'+l;u+=""+l+""+l}u+=""+l;for(;a"+l:u+=''+l;u+=""+l}u+=""+l,u+=""+l+"
      ",this.get("host").insertContentAtFocusPoint(u),this.markUpdated()},_findColumnCells:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=new e.NodeList,s=new e.NodeList;return n.each(function(e){var n=e.all("td, th"),o=n.item(t),u=n.item(t-1),a=n.item(t+1);r.push(o),u&&i.push(u),a&&s.push(a)}),{current:r,prev:i,next:s}},_hideInvalidEntries:function(e){var t=this._lastTarget.ancestor("table"),n=this._lastTarget.ancestor("tr"),r=t.all("tr"),i=r.indexOf(n),s=r.item(i-1),o=s?s.one("td"):null;!n||!o?e.one('[data-change="moverowup"]').hide():e.one('[data-change="moverowup"]').show();var u=r.item(i+1),a=n?n.one("td"):!1;!n||!u||!a?e.one('[data-change="moverowdown"]').hide():e.one('[data-change="moverowdown"]').show();var f=this._findColumnCells();f.prev.filter("td").size()>0?e.one('[data-change="movecolumnleft"]').show():e.one('[data-change="movecolumnleft"]').hide();var l=f.current.filter("td").size()>0;f.next.size()>0&&l?e.one('[data-change="movecolumnright"]').show():e.one('[data-change="movecolumnright"]').hide(),f.current.filter("td").size()>0?e.one('[data-change="deletecolumn"]').show():e.one('[data-change="deletecolumn"]').hide(),!n||!n.one("td")?e.one('[data-change="deleterow"]').hide():e.one('[data-change="deleterow"]').show()},_showTableMenu:function(t){t.preventDefault();var r;this._contextMenu||(this._menuOptions=[{text:M.util.get_string("addcolumnafter",n),data:{change:"addcolumnafter"}},{text:M.util.get_string("addrowafter",n),data:{change:"addrowafter"}},{text:M.util.get_string("moverowup",n),data:{change:"moverowup"}},{text:M.util.get_string("moverowdown",n),data:{change:"moverowdown"}},{text:M.util.get_string("movecolumnleft",n),data:{change:"movecolumnleft"}},{text:M.util.get_string("movecolumnright",n),data:{change:"movecolumnright"}},{text:M.util.get_string("deleterow",n),data:{change:"deleterow"}},{text:M.util.get_string("deletecolumn",n),data:{change:"deletecolumn"}},{text:M.util.get_string("edittable",n),data:{change:"edittable"}}],this._contextMenu=new e.M.editor_atto.Menu({items:this._menuOptions}),r=this._contextMenu.get("boundingBox"),r.delegate("click",this._handleTableChange,"a",this)),r=this._contextMenu.get("boundingBox"),this._lastTarget=t.tableCell.ancestor(".editor_atto_content td, .editor_atto_content th",!0),this._hideInvalidEntries(r),e.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)});var i=this.buttons[this.name];this.get("host")._setTabFocus(i),this._contextMenu.show(),this._contextMenu.align(this.buttons.table,[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),this._contextMenu.set("focusAfterHide",i),r.one("a")&&r.one("a").focus(),this.get("host").openMenus=[this._contextMenu]},_handleTableChange:function(e){e.preventDefault(),this._contextMenu.set("focusAfterHide",this.get("host").editor),this._contextMenu.hide(e);switch(e.target.getData("change")){case"addcolumnafter":this._addColumnAfter();break;case"addrowafter":this._addRowAfter();break;case"deleterow":this._deleteRow();break;case"deletecolumn":this._deleteColumn();break;case"edittable":this._editTable();break;case"moverowdown":this._moveRowDown();break;case"moverowup":this._moveRowUp();break;case"movecolumnleft":this._moveColumnLeft();break;case"movecolumnright":this._moveColumnRight()}},_getRowIndex:function(e){var t=e.ancestor("table"),n=e.ancestor("tr");if(!t||!n)return;var r=t.all("tr");return r.indexOf(n)},_getColumnIndex:function(e){var t=e.ancestor("tr");if(!t)return;var n=t.all("td, th");return n.indexOf(e)},_deleteRow:function(){var e=this._lastTarget.ancestor("tr");e&&e.one("td")&&e.remove(!0),this.markUpdated()},_moveRowUp:function(){var e=this._lastTarget.ancestor("tr"),t=e.previous("tr");if(!e||!t)return;e.swap(t),this.markUpdated()},_moveColumnLeft:function(){var e=this._findColumnCells();if(e.current.size()>0&&e.prev.size()>0&&e.current.size()===e.prev.size()){var t=0;for(t=0;t "),1)},_removeCaption:function(){var e=this._lastTarget.ancestor("table"),t=e.one("caption");t&&t.remove(!0)},_moveColumnRight:function(){var e=this._findColumnCells();if(e.next.size()>0&&e.current.size()===e.next.size()&&e.current.filter("td").size()>0){var t=0;for(t=0;t");t.replace(n),t=n}t.setHTML(" ")}),n.insert(newrow,t),this.markUpdated()},_addColumnAfter:function(){var t=this._findColumnCells(),n=!0,r=t.next;t.next.size()<=0&&(n=!1,r=t.current),e.each(r,function(e){var t=e.cloneNode();t.setHTML(" "),n?e.get("parentNode").insert(t,e):(e.get("parentNode").insert(t,e),e.swap(t))},this),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-editor_atto-menu","event","event-valuechange"]}); diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js index 221375f65e8..cd32dee7fee 100644 --- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js +++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js @@ -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(); }, /** diff --git a/lib/editor/atto/plugins/table/yui/src/button/js/button.js b/lib/editor/atto/plugins/table/yui/src/button/js/button.js index a34ef41cf82..6c1389adf72 100644 --- a/lib/editor/atto/plugins/table/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/table/yui/src/button/js/button.js @@ -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(); }, /** From b18fd23232f67739765f87b324de7a69d0f3944f Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 11 Jun 2014 15:24:30 +0800 Subject: [PATCH 3/6] MDL-44871 Atto: Move custom select text step to atto specific step definition. --- lib/behat/form_field/behat_form_field.php | 8 --- .../tests/behat/accessibilityhelper.feature | 6 +- .../plugins/align/tests/behat/align.feature | 6 +- .../plugins/bold/tests/behat/bold.feature | 4 +- .../charmap/tests/behat/charmap.feature | 2 +- .../plugins/clear/tests/behat/clear.feature | 2 +- .../equation/tests/behat/equation.feature | 2 +- .../plugins/image/tests/behat/image.feature | 4 +- .../plugins/indent/tests/behat/indent.feature | 4 +- .../plugins/italic/tests/behat/italic.feature | 4 +- .../plugins/link/tests/behat/link.feature | 2 +- .../plugins/media/tests/behat/media.feature | 2 +- .../tests/behat/orderedlist.feature | 2 +- .../plugins/strike/tests/behat/strike.feature | 2 +- .../subscript/tests/behat/subscript.feature | 2 +- .../tests/behat/superscript.feature | 2 +- .../plugins/table/tests/behat/table.feature | 4 +- .../plugins/title/tests/behat/title.feature | 2 +- .../underline/tests/behat/underline.feature | 2 +- .../tests/behat/unorderedlist.feature | 2 +- .../atto/tests/behat/behat_editor_atto.php | 62 +++++++++++++++++++ lib/tests/behat/behat_forms.php | 29 --------- 22 files changed, 90 insertions(+), 65 deletions(-) create mode 100644 lib/editor/atto/tests/behat/behat_editor_atto.php diff --git a/lib/behat/form_field/behat_form_field.php b/lib/behat/form_field/behat_form_field.php index 6c2392135dc..d97ce537f63 100644 --- a/lib/behat/form_field/behat_form_field.php +++ b/lib/behat/form_field/behat_form_field.php @@ -235,12 +235,4 @@ 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/accessibilityhelper/tests/behat/accessibilityhelper.feature b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature index 3762a17b764..92dc58e13e4 100644 --- a/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature +++ b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature @@ -8,7 +8,7 @@ Feature: Atto accessibility helper 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 + 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" @@ -25,10 +25,10 @@ Feature: Atto accessibility helper And I follow "Edit profile" And I set the field "Description" to "

      Some plain text

      " When I click on "Show more buttons" "button" - And I select the text in the "Description" field + 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" field + 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" diff --git a/lib/editor/atto/plugins/align/tests/behat/align.feature b/lib/editor/atto/plugins/align/tests/behat/align.feature index 51515a6af6c..893fcdbe7ce 100644 --- a/lib/editor/atto/plugins/align/tests/behat/align.feature +++ b/lib/editor/atto/plugins/align/tests/behat/align.feature @@ -10,7 +10,7 @@ Feature: Atto align text 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 + 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" @@ -24,7 +24,7 @@ Feature: Atto align text 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 + 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" @@ -39,7 +39,7 @@ Feature: Atto align text 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 + 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" diff --git a/lib/editor/atto/plugins/bold/tests/behat/bold.feature b/lib/editor/atto/plugins/bold/tests/behat/bold.feature index 0a1b49a113e..3aef641972a 100644 --- a/lib/editor/atto/plugins/bold/tests/behat/bold.feature +++ b/lib/editor/atto/plugins/bold/tests/behat/bold.feature @@ -9,7 +9,7 @@ Feature: Atto bold button 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 + 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" @@ -22,7 +22,7 @@ Feature: Atto bold button 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 + 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" diff --git a/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature index eb5828ff87e..b68fddf2e52 100644 --- a/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature +++ b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature @@ -9,7 +9,7 @@ Feature: Atto charmap button 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

      " - And I select the text in the "Description" field + 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" diff --git a/lib/editor/atto/plugins/clear/tests/behat/clear.feature b/lib/editor/atto/plugins/clear/tests/behat/clear.feature index 59e38f90bff..18483996611 100644 --- a/lib/editor/atto/plugins/clear/tests/behat/clear.feature +++ b/lib/editor/atto/plugins/clear/tests/behat/clear.feature @@ -10,7 +10,7 @@ Feature: Atto clear button 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 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" diff --git a/lib/editor/atto/plugins/equation/tests/behat/equation.feature b/lib/editor/atto/plugins/equation/tests/behat/equation.feature index 31474091f1e..39754bbc2f7 100644 --- a/lib/editor/atto/plugins/equation/tests/behat/equation.feature +++ b/lib/editor/atto/plugins/equation/tests/behat/equation.feature @@ -8,7 +8,7 @@ Feature: Atto equation editor When I follow "Admin User" And I follow "Edit profile" And I set the field "Description" to "

      Equation test

      " - And I select the text in the "Description" field + 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" diff --git a/lib/editor/atto/plugins/image/tests/behat/image.feature b/lib/editor/atto/plugins/image/tests/behat/image.feature index 566cc441863..984e5034103 100644 --- a/lib/editor/atto/plugins/image/tests/behat/image.feature +++ b/lib/editor/atto/plugins/image/tests/behat/image.feature @@ -11,7 +11,7 @@ Feature: Add images to Atto When I follow "Admin User" And I follow "Edit profile" And I set the field "Description" to "

      Image test

      " - And I select the text in the "Description" field + 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" @@ -23,7 +23,7 @@ Feature: Add images to Atto 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 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" diff --git a/lib/editor/atto/plugins/indent/tests/behat/indent.feature b/lib/editor/atto/plugins/indent/tests/behat/indent.feature index 5106de839cd..8ef72ab032e 100644 --- a/lib/editor/atto/plugins/indent/tests/behat/indent.feature +++ b/lib/editor/atto/plugins/indent/tests/behat/indent.feature @@ -9,7 +9,7 @@ Feature: Indent text in Atto 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 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" @@ -23,7 +23,7 @@ Feature: Indent text in Atto 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 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" diff --git a/lib/editor/atto/plugins/italic/tests/behat/italic.feature b/lib/editor/atto/plugins/italic/tests/behat/italic.feature index a582132a362..f1fca1d23fb 100644 --- a/lib/editor/atto/plugins/italic/tests/behat/italic.feature +++ b/lib/editor/atto/plugins/italic/tests/behat/italic.feature @@ -9,7 +9,7 @@ Feature: Atto italic button 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 + 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" @@ -22,7 +22,7 @@ Feature: Atto italic button 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 + 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" diff --git a/lib/editor/atto/plugins/link/tests/behat/link.feature b/lib/editor/atto/plugins/link/tests/behat/link.feature index 00a1e05d457..8edd2e4513b 100644 --- a/lib/editor/atto/plugins/link/tests/behat/link.feature +++ b/lib/editor/atto/plugins/link/tests/behat/link.feature @@ -12,7 +12,7 @@ Feature: Add links to Atto 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 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" diff --git a/lib/editor/atto/plugins/media/tests/behat/media.feature b/lib/editor/atto/plugins/media/tests/behat/media.feature index a8eff24ec76..d0d993dd359 100644 --- a/lib/editor/atto/plugins/media/tests/behat/media.feature +++ b/lib/editor/atto/plugins/media/tests/behat/media.feature @@ -13,7 +13,7 @@ Feature: Add media to Atto And I expand "Blogs" node And I follow "Add a new entry" And I set the field "Blog entry body" to "

      Media test

      " - And I select the text in the "Blog entry body" field + 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" diff --git a/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature b/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature index 8b85d903ca4..38140c3d397 100644 --- a/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature +++ b/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature @@ -9,7 +9,7 @@ Feature: Atto ordered list button 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 + 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" diff --git a/lib/editor/atto/plugins/strike/tests/behat/strike.feature b/lib/editor/atto/plugins/strike/tests/behat/strike.feature index 7eac7b50f99..c56f5297792 100644 --- a/lib/editor/atto/plugins/strike/tests/behat/strike.feature +++ b/lib/editor/atto/plugins/strike/tests/behat/strike.feature @@ -9,7 +9,7 @@ Feature: Atto strike button 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 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" diff --git a/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature b/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature index c918ad65986..9dbc8e7376b 100644 --- a/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature +++ b/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature @@ -9,7 +9,7 @@ Feature: Atto subscript button 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 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" diff --git a/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature b/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature index ed3e0c9a497..cf9a563b3bd 100644 --- a/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature +++ b/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature @@ -9,7 +9,7 @@ Feature: Atto superscript button 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 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" diff --git a/lib/editor/atto/plugins/table/tests/behat/table.feature b/lib/editor/atto/plugins/table/tests/behat/table.feature index 8b79bcb393b..857d36a5527 100644 --- a/lib/editor/atto/plugins/table/tests/behat/table.feature +++ b/lib/editor/atto/plugins/table/tests/behat/table.feature @@ -11,7 +11,7 @@ Feature: Atto tables 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" field + 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" @@ -28,7 +28,7 @@ Feature: Atto tables 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 "
      Cell
      " - And I select the text in the "Blog entry body" field + 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" diff --git a/lib/editor/atto/plugins/title/tests/behat/title.feature b/lib/editor/atto/plugins/title/tests/behat/title.feature index 900f0da222a..896a1249c08 100644 --- a/lib/editor/atto/plugins/title/tests/behat/title.feature +++ b/lib/editor/atto/plugins/title/tests/behat/title.feature @@ -9,7 +9,7 @@ Feature: Atto title 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 + 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" diff --git a/lib/editor/atto/plugins/underline/tests/behat/underline.feature b/lib/editor/atto/plugins/underline/tests/behat/underline.feature index ffc56a751c6..a16913e356c 100644 --- a/lib/editor/atto/plugins/underline/tests/behat/underline.feature +++ b/lib/editor/atto/plugins/underline/tests/behat/underline.feature @@ -9,7 +9,7 @@ Feature: Atto underline button 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 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" diff --git a/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature b/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature index f148bb9dfc9..38211117c9d 100644 --- a/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature +++ b/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature @@ -9,7 +9,7 @@ Feature: Atto unordered list button 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 + 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" diff --git a/lib/editor/atto/tests/behat/behat_editor_atto.php b/lib/editor/atto/tests/behat/behat_editor_atto.php new file mode 100644 index 00000000000..91723d841fb --- /dev/null +++ b/lib/editor/atto/tests/behat/behat_editor_atto.php @@ -0,0 +1,62 @@ +. + +/** + * 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(); + } + + +} + diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index a0af7f7031c..b686efbdc6d 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -155,18 +155,6 @@ 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. * @@ -344,23 +332,6 @@ 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. * From 32d746479b9b28d11b96ba2d68291ad1d61de239 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 11 Jun 2014 16:29:38 +0800 Subject: [PATCH 4/6] MDL-44871 Atto behat: Use one less page load to get to profile edit page --- .../tests/behat/accessibilitychecker.feature | 6 ++---- .../tests/behat/accessibilityhelper.feature | 6 ++---- lib/editor/atto/plugins/align/tests/behat/align.feature | 9 +++------ lib/editor/atto/plugins/bold/tests/behat/bold.feature | 6 ++---- .../atto/plugins/charmap/tests/behat/charmap.feature | 3 +-- lib/editor/atto/plugins/clear/tests/behat/clear.feature | 3 +-- .../atto/plugins/collapse/tests/behat/collapse.feature | 3 +-- .../atto/plugins/equation/tests/behat/equation.feature | 3 +-- lib/editor/atto/plugins/html/tests/behat/html.feature | 3 +-- lib/editor/atto/plugins/image/tests/behat/image.feature | 3 +-- .../atto/plugins/indent/tests/behat/indent.feature | 6 ++---- .../atto/plugins/italic/tests/behat/italic.feature | 6 ++---- lib/editor/atto/plugins/link/tests/behat/link.feature | 3 +-- .../plugins/orderedlist/tests/behat/orderedlist.feature | 3 +-- .../atto/plugins/strike/tests/behat/strike.feature | 3 +-- .../atto/plugins/subscript/tests/behat/subscript.feature | 3 +-- .../plugins/superscript/tests/behat/superscript.feature | 3 +-- lib/editor/atto/plugins/title/tests/behat/title.feature | 3 +-- .../atto/plugins/underline/tests/behat/underline.feature | 3 +-- .../unorderedlist/tests/behat/unorderedlist.feature | 3 +-- 20 files changed, 27 insertions(+), 54 deletions(-) diff --git a/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature b/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature index 396d9902931..caf46bfdb0d 100644 --- a/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature +++ b/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature @@ -5,8 +5,7 @@ Feature: Atto accessibility checker @javascript Scenario: Images with no alt Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" 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" @@ -15,8 +14,7 @@ Feature: Atto accessibility checker @javascript Scenario: Low contrast Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" 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" diff --git a/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature index 92dc58e13e4..79913def2fd 100644 --- a/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature +++ b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature @@ -5,8 +5,7 @@ Feature: Atto accessibility helper @javascript Scenario: Images and links Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" And I set the field "Description" to "

      Some plain text

      Image 1

      Some link text

      " And I select the text in the "Description" Atto editor When I click on "Show more buttons" "button" @@ -21,8 +20,7 @@ Feature: Atto accessibility helper @javascript Scenario: Styles Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" And I set the field "Description" to "

      Some plain text

      " When I click on "Show more buttons" "button" And I select the text in the "Description" Atto editor diff --git a/lib/editor/atto/plugins/align/tests/behat/align.feature b/lib/editor/atto/plugins/align/tests/behat/align.feature index 893fcdbe7ce..9e69765a0f7 100644 --- a/lib/editor/atto/plugins/align/tests/behat/align.feature +++ b/lib/editor/atto/plugins/align/tests/behat/align.feature @@ -5,8 +5,7 @@ Feature: Atto align text @javascript Scenario: Right align some text Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" 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" @@ -19,8 +18,7 @@ Feature: Atto align text @javascript Scenario: Left align some text Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" 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" @@ -34,8 +32,7 @@ Feature: Atto align text @javascript Scenario: Center align some text Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + And I navigate to "Edit profile" node in "My profile settings" 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" diff --git a/lib/editor/atto/plugins/bold/tests/behat/bold.feature b/lib/editor/atto/plugins/bold/tests/behat/bold.feature index 3aef641972a..2497bd2135c 100644 --- a/lib/editor/atto/plugins/bold/tests/behat/bold.feature +++ b/lib/editor/atto/plugins/bold/tests/behat/bold.feature @@ -5,8 +5,7 @@ Feature: Atto 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 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 @@ -18,8 +17,7 @@ Feature: Atto bold button @javascript Scenario: Unbold some text Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + 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 diff --git a/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature index b68fddf2e52..5afc37478bf 100644 --- a/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature +++ b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature @@ -5,8 +5,7 @@ Feature: Atto charmap button @javascript Scenario: Insert symbols Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + 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 "

      1980 Mullet

      " And I select the text in the "Description" Atto editor diff --git a/lib/editor/atto/plugins/clear/tests/behat/clear.feature b/lib/editor/atto/plugins/clear/tests/behat/clear.feature index 18483996611..8189166b1e2 100644 --- a/lib/editor/atto/plugins/clear/tests/behat/clear.feature +++ b/lib/editor/atto/plugins/clear/tests/behat/clear.feature @@ -5,8 +5,7 @@ Feature: Atto clear button @javascript Scenario: Clear formatting Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + 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 "

      Pisa

      " When I click on "Show more buttons" "button" diff --git a/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature b/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature index ed2a87e2ae9..458542325f3 100644 --- a/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature +++ b/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature @@ -5,8 +5,7 @@ Feature: Atto collapse button @javascript Scenario: Toggle toolbar Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + 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" diff --git a/lib/editor/atto/plugins/equation/tests/behat/equation.feature b/lib/editor/atto/plugins/equation/tests/behat/equation.feature index 39754bbc2f7..44dbb3eb225 100644 --- a/lib/editor/atto/plugins/equation/tests/behat/equation.feature +++ b/lib/editor/atto/plugins/equation/tests/behat/equation.feature @@ -5,8 +5,7 @@ Feature: Atto equation editor @javascript Scenario: Create an equation Given I log in as "admin" - When I follow "Admin User" - And I follow "Edit profile" + When I navigate to "Edit profile" node in "My profile settings" And I set the field "Description" to "

      Equation test

      " And I select the text in the "Description" Atto editor And I click on "Show more buttons" "button" diff --git a/lib/editor/atto/plugins/html/tests/behat/html.feature b/lib/editor/atto/plugins/html/tests/behat/html.feature index 735a8215be1..eb617c620ed 100644 --- a/lib/editor/atto/plugins/html/tests/behat/html.feature +++ b/lib/editor/atto/plugins/html/tests/behat/html.feature @@ -5,8 +5,7 @@ Feature: Atto edit HTML @javascript Scenario: Edit the html source Given I log in as "admin" - When I follow "Admin User" - And I follow "Edit profile" + When I navigate to "Edit profile" node in "My profile settings" And I set the field "Description" to "

      Smurf

      " And I click on "Show more buttons" "button" And I click on "HTML" "button" diff --git a/lib/editor/atto/plugins/image/tests/behat/image.feature b/lib/editor/atto/plugins/image/tests/behat/image.feature index 984e5034103..77905ac6c6f 100644 --- a/lib/editor/atto/plugins/image/tests/behat/image.feature +++ b/lib/editor/atto/plugins/image/tests/behat/image.feature @@ -8,8 +8,7 @@ Feature: Add images to Atto 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" + When I navigate to "Edit profile" node in "My profile settings" And I set the field "Description" to "

      Image test

      " And I select the text in the "Description" Atto editor And I click on "Image" "button" diff --git a/lib/editor/atto/plugins/indent/tests/behat/indent.feature b/lib/editor/atto/plugins/indent/tests/behat/indent.feature index 8ef72ab032e..7aa5bf60f22 100644 --- a/lib/editor/atto/plugins/indent/tests/behat/indent.feature +++ b/lib/editor/atto/plugins/indent/tests/behat/indent.feature @@ -5,8 +5,7 @@ Feature: Indent text in Atto @javascript Scenario: Indent Given I log in as "admin" - When I follow "Admin User" - And I follow "Edit profile" + When I navigate to "Edit profile" node in "My profile settings" 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" Atto editor @@ -19,8 +18,7 @@ Feature: Indent text in Atto @javascript Scenario: Indent and outdent Given I log in as "admin" - When I follow "Admin User" - And I follow "Edit profile" + When I navigate to "Edit profile" node in "My profile settings" 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" Atto editor diff --git a/lib/editor/atto/plugins/italic/tests/behat/italic.feature b/lib/editor/atto/plugins/italic/tests/behat/italic.feature index f1fca1d23fb..e17f6366690 100644 --- a/lib/editor/atto/plugins/italic/tests/behat/italic.feature +++ b/lib/editor/atto/plugins/italic/tests/behat/italic.feature @@ -5,8 +5,7 @@ Feature: Atto 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 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 @@ -18,8 +17,7 @@ Feature: Atto italic button @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 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 diff --git a/lib/editor/atto/plugins/link/tests/behat/link.feature b/lib/editor/atto/plugins/link/tests/behat/link.feature index 8edd2e4513b..68e45cc61cf 100644 --- a/lib/editor/atto/plugins/link/tests/behat/link.feature +++ b/lib/editor/atto/plugins/link/tests/behat/link.feature @@ -8,8 +8,7 @@ Feature: Add links to Atto 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" + 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 diff --git a/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature b/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature index 38140c3d397..eb937e45b57 100644 --- a/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature +++ b/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature @@ -5,8 +5,7 @@ Feature: Atto 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 navigate to "Edit profile" node in "My profile settings" 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" Atto editor diff --git a/lib/editor/atto/plugins/strike/tests/behat/strike.feature b/lib/editor/atto/plugins/strike/tests/behat/strike.feature index c56f5297792..9cf737e80cf 100644 --- a/lib/editor/atto/plugins/strike/tests/behat/strike.feature +++ b/lib/editor/atto/plugins/strike/tests/behat/strike.feature @@ -5,8 +5,7 @@ Feature: Atto 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 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 diff --git a/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature b/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature index 9dbc8e7376b..bbd62738c2f 100644 --- a/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature +++ b/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature @@ -5,8 +5,7 @@ Feature: Atto 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 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 diff --git a/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature b/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature index cf9a563b3bd..fbc3467098a 100644 --- a/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature +++ b/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature @@ -5,8 +5,7 @@ Feature: Atto 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 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 diff --git a/lib/editor/atto/plugins/title/tests/behat/title.feature b/lib/editor/atto/plugins/title/tests/behat/title.feature index 896a1249c08..32eba6f105d 100644 --- a/lib/editor/atto/plugins/title/tests/behat/title.feature +++ b/lib/editor/atto/plugins/title/tests/behat/title.feature @@ -5,8 +5,7 @@ Feature: Atto title @javascript Scenario: Create a heading Given I log in as "admin" - And I follow "Admin User" - And I follow "Edit profile" + 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 diff --git a/lib/editor/atto/plugins/underline/tests/behat/underline.feature b/lib/editor/atto/plugins/underline/tests/behat/underline.feature index a16913e356c..e354f46019a 100644 --- a/lib/editor/atto/plugins/underline/tests/behat/underline.feature +++ b/lib/editor/atto/plugins/underline/tests/behat/underline.feature @@ -5,8 +5,7 @@ Feature: Atto 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 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 diff --git a/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature b/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature index 38211117c9d..64d4f23eede 100644 --- a/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature +++ b/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature @@ -5,8 +5,7 @@ Feature: Atto 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 navigate to "Edit profile" node in "My profile settings" 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" Atto editor From 77ae35faba93ffd2d062bcc7a89ed9ae1e9f9713 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Wed, 11 Jun 2014 16:47:02 +0800 Subject: [PATCH 5/6] MDL-44871 behat: Hack to make equation editor visible --- lib/editor/atto/plugins/equation/tests/behat/equation.feature | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/editor/atto/plugins/equation/tests/behat/equation.feature b/lib/editor/atto/plugins/equation/tests/behat/equation.feature index 44dbb3eb225..6964f38c370 100644 --- a/lib/editor/atto/plugins/equation/tests/behat/equation.feature +++ b/lib/editor/atto/plugins/equation/tests/behat/equation.feature @@ -7,6 +7,9 @@ Feature: Atto equation editor Given I log in as "admin" When I navigate to "Edit profile" node in "My profile settings" And I set the field "Description" to "

      Equation test

      " + # 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" From f271df32ec8cfabe734c00acd5621151b869c341 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Thu, 12 Jun 2014 11:14:21 +0800 Subject: [PATCH 6/6] MDL-44871 Atto: Add missing tags to behat tests @editor and @editor_atto --- .../tests/behat/accessibilitychecker.feature | 2 +- .../accessibilityhelper/tests/behat/accessibilityhelper.feature | 2 +- lib/editor/atto/plugins/align/tests/behat/align.feature | 2 +- lib/editor/atto/plugins/bold/tests/behat/bold.feature | 2 +- lib/editor/atto/plugins/charmap/tests/behat/charmap.feature | 2 +- lib/editor/atto/plugins/clear/tests/behat/clear.feature | 2 +- lib/editor/atto/plugins/collapse/tests/behat/collapse.feature | 2 +- lib/editor/atto/plugins/equation/tests/behat/equation.feature | 2 +- lib/editor/atto/plugins/html/tests/behat/html.feature | 2 +- lib/editor/atto/plugins/image/tests/behat/image.feature | 2 +- lib/editor/atto/plugins/indent/tests/behat/indent.feature | 2 +- lib/editor/atto/plugins/italic/tests/behat/italic.feature | 2 +- lib/editor/atto/plugins/link/tests/behat/link.feature | 2 +- lib/editor/atto/plugins/media/tests/behat/media.feature | 2 +- .../atto/plugins/orderedlist/tests/behat/orderedlist.feature | 2 +- lib/editor/atto/plugins/strike/tests/behat/strike.feature | 2 +- lib/editor/atto/plugins/subscript/tests/behat/subscript.feature | 2 +- .../atto/plugins/superscript/tests/behat/superscript.feature | 2 +- lib/editor/atto/plugins/table/tests/behat/table.feature | 2 +- lib/editor/atto/plugins/title/tests/behat/title.feature | 2 +- lib/editor/atto/plugins/underline/tests/behat/underline.feature | 2 +- .../plugins/unorderedlist/tests/behat/unorderedlist.feature | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature b/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature index caf46bfdb0d..c456bc6c32a 100644 --- a/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature +++ b/lib/editor/atto/plugins/accessibilitychecker/tests/behat/accessibilitychecker.feature @@ -1,4 +1,4 @@ -@atto @atto_accessibilitychecker +@editor @editor_atto @atto @atto_accessibilitychecker Feature: Atto accessibility checker To write accessible text in Atto, I need to check for accessibility warnings. diff --git a/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature index 79913def2fd..a633fd24eff 100644 --- a/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature +++ b/lib/editor/atto/plugins/accessibilityhelper/tests/behat/accessibilityhelper.feature @@ -1,4 +1,4 @@ -@atto @atto_accessibilityhelper +@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 diff --git a/lib/editor/atto/plugins/align/tests/behat/align.feature b/lib/editor/atto/plugins/align/tests/behat/align.feature index 9e69765a0f7..6095ec53b55 100644 --- a/lib/editor/atto/plugins/align/tests/behat/align.feature +++ b/lib/editor/atto/plugins/align/tests/behat/align.feature @@ -1,4 +1,4 @@ -@atto @atto_align +@editor @editor_atto @atto @atto_align Feature: Atto align text To format text in Atto, I need to use the align buttons. diff --git a/lib/editor/atto/plugins/bold/tests/behat/bold.feature b/lib/editor/atto/plugins/bold/tests/behat/bold.feature index 2497bd2135c..72d77306ce9 100644 --- a/lib/editor/atto/plugins/bold/tests/behat/bold.feature +++ b/lib/editor/atto/plugins/bold/tests/behat/bold.feature @@ -1,4 +1,4 @@ -@atto @atto_bold @_bug_phantomjs +@editor @editor_atto @atto @atto_bold @_bug_phantomjs Feature: Atto bold button To format text in Atto, I need to use the bold button. diff --git a/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature index 5afc37478bf..a73ee3f662c 100644 --- a/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature +++ b/lib/editor/atto/plugins/charmap/tests/behat/charmap.feature @@ -1,4 +1,4 @@ -@atto @atto_charmap +@editor @editor_atto @atto @atto_charmap Feature: Atto charmap button To format text in Atto, I need to add symbols diff --git a/lib/editor/atto/plugins/clear/tests/behat/clear.feature b/lib/editor/atto/plugins/clear/tests/behat/clear.feature index 8189166b1e2..b1926c6b1f4 100644 --- a/lib/editor/atto/plugins/clear/tests/behat/clear.feature +++ b/lib/editor/atto/plugins/clear/tests/behat/clear.feature @@ -1,4 +1,4 @@ -@atto @atto_clear @_bug_phantomjs +@editor @editor_atto @atto @atto_clear @_bug_phantomjs Feature: Atto clear button To format text in Atto, I need to remove formatting diff --git a/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature b/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature index 458542325f3..ab37d18d6be 100644 --- a/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature +++ b/lib/editor/atto/plugins/collapse/tests/behat/collapse.feature @@ -1,4 +1,4 @@ -@atto @atto_collapse +@editor @editor_atto @atto @atto_collapse Feature: Atto collapse button To access all the tools in Atto, I need to toggle the toolbar diff --git a/lib/editor/atto/plugins/equation/tests/behat/equation.feature b/lib/editor/atto/plugins/equation/tests/behat/equation.feature index 6964f38c370..0b20f4602e4 100644 --- a/lib/editor/atto/plugins/equation/tests/behat/equation.feature +++ b/lib/editor/atto/plugins/equation/tests/behat/equation.feature @@ -1,4 +1,4 @@ -@atto @atto_equation +@editor @editor_atto @atto @atto_equation Feature: Atto equation editor To teach maths to students, I need to write equations diff --git a/lib/editor/atto/plugins/html/tests/behat/html.feature b/lib/editor/atto/plugins/html/tests/behat/html.feature index eb617c620ed..35f02fce40a 100644 --- a/lib/editor/atto/plugins/html/tests/behat/html.feature +++ b/lib/editor/atto/plugins/html/tests/behat/html.feature @@ -1,4 +1,4 @@ -@atto @atto_html +@editor @editor_atto @atto @atto_html Feature: Atto edit HTML To write advanced HTML, I need to edit the HTML source code diff --git a/lib/editor/atto/plugins/image/tests/behat/image.feature b/lib/editor/atto/plugins/image/tests/behat/image.feature index 77905ac6c6f..3620a8901a1 100644 --- a/lib/editor/atto/plugins/image/tests/behat/image.feature +++ b/lib/editor/atto/plugins/image/tests/behat/image.feature @@ -1,4 +1,4 @@ -@atto @atto_image @_file_upload +@editor @editor_atto @atto @atto_image @_file_upload Feature: Add images to Atto To write rich text - I need to add images. diff --git a/lib/editor/atto/plugins/indent/tests/behat/indent.feature b/lib/editor/atto/plugins/indent/tests/behat/indent.feature index 7aa5bf60f22..212d7c0ef9a 100644 --- a/lib/editor/atto/plugins/indent/tests/behat/indent.feature +++ b/lib/editor/atto/plugins/indent/tests/behat/indent.feature @@ -1,4 +1,4 @@ -@atto @atto_indent +@editor @editor_atto @atto @atto_indent Feature: Indent text in Atto To write rich text - I need to indent and outdent things. diff --git a/lib/editor/atto/plugins/italic/tests/behat/italic.feature b/lib/editor/atto/plugins/italic/tests/behat/italic.feature index e17f6366690..3efcea7ba40 100644 --- a/lib/editor/atto/plugins/italic/tests/behat/italic.feature +++ b/lib/editor/atto/plugins/italic/tests/behat/italic.feature @@ -1,4 +1,4 @@ -@atto @atto_italic @_bug_phantomjs +@editor @editor_atto @atto @atto_italic @_bug_phantomjs Feature: Atto italic button To format text in Atto, I need to use the italic button. diff --git a/lib/editor/atto/plugins/link/tests/behat/link.feature b/lib/editor/atto/plugins/link/tests/behat/link.feature index 68e45cc61cf..444213b165f 100644 --- a/lib/editor/atto/plugins/link/tests/behat/link.feature +++ b/lib/editor/atto/plugins/link/tests/behat/link.feature @@ -1,4 +1,4 @@ -@atto @atto_link @_file_upload +@editor @editor_atto @atto @atto_link @_file_upload Feature: Add links to Atto To write rich text - I need to add links. diff --git a/lib/editor/atto/plugins/media/tests/behat/media.feature b/lib/editor/atto/plugins/media/tests/behat/media.feature index d0d993dd359..fb5232aa52f 100644 --- a/lib/editor/atto/plugins/media/tests/behat/media.feature +++ b/lib/editor/atto/plugins/media/tests/behat/media.feature @@ -1,4 +1,4 @@ -@atto @atto_media @_file_upload +@editor @editor_atto @atto @atto_media @_file_upload Feature: Add media to Atto To write rich text - I need to add media. diff --git a/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature b/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature index eb937e45b57..5e77c793d50 100644 --- a/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature +++ b/lib/editor/atto/plugins/orderedlist/tests/behat/orderedlist.feature @@ -1,4 +1,4 @@ -@atto @atto_orderedlist @_bug_phantomjs +@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. diff --git a/lib/editor/atto/plugins/strike/tests/behat/strike.feature b/lib/editor/atto/plugins/strike/tests/behat/strike.feature index 9cf737e80cf..f919947eb3b 100644 --- a/lib/editor/atto/plugins/strike/tests/behat/strike.feature +++ b/lib/editor/atto/plugins/strike/tests/behat/strike.feature @@ -1,4 +1,4 @@ -@atto @atto_strike @_bug_phantomjs +@editor @editor_atto @atto @atto_strike @_bug_phantomjs Feature: Atto strike button To format text in Atto, I need to use the strike button. diff --git a/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature b/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature index bbd62738c2f..bc5977850c3 100644 --- a/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature +++ b/lib/editor/atto/plugins/subscript/tests/behat/subscript.feature @@ -1,4 +1,4 @@ -@atto @atto_subscript @_bug_phantomjs +@editor @editor_atto @atto @atto_subscript @_bug_phantomjs Feature: Atto subscript button To format text in Atto, I need to use the subscript button. diff --git a/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature b/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature index fbc3467098a..703fd96f7cf 100644 --- a/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature +++ b/lib/editor/atto/plugins/superscript/tests/behat/superscript.feature @@ -1,4 +1,4 @@ -@atto @atto_superscript @_bug_phantomjs +@editor @editor_atto @atto @atto_superscript @_bug_phantomjs Feature: Atto superscript button To format text in Atto, I need to use the superscript button. diff --git a/lib/editor/atto/plugins/table/tests/behat/table.feature b/lib/editor/atto/plugins/table/tests/behat/table.feature index 857d36a5527..2915445813c 100644 --- a/lib/editor/atto/plugins/table/tests/behat/table.feature +++ b/lib/editor/atto/plugins/table/tests/behat/table.feature @@ -1,4 +1,4 @@ -@atto @atto_table @_bug_phantomjs +@editor @editor_atto @atto @atto_table @_bug_phantomjs Feature: Atto tables To format text in Atto, I need to create tables diff --git a/lib/editor/atto/plugins/title/tests/behat/title.feature b/lib/editor/atto/plugins/title/tests/behat/title.feature index 32eba6f105d..15e4e8e7ce2 100644 --- a/lib/editor/atto/plugins/title/tests/behat/title.feature +++ b/lib/editor/atto/plugins/title/tests/behat/title.feature @@ -1,4 +1,4 @@ -@atto @atto_title +@editor @editor_atto @atto @atto_title Feature: Atto title To format text in Atto, I need to add headings diff --git a/lib/editor/atto/plugins/underline/tests/behat/underline.feature b/lib/editor/atto/plugins/underline/tests/behat/underline.feature index e354f46019a..c2d532b7bc5 100644 --- a/lib/editor/atto/plugins/underline/tests/behat/underline.feature +++ b/lib/editor/atto/plugins/underline/tests/behat/underline.feature @@ -1,4 +1,4 @@ -@atto @atto_underline @_bug_phantomjs +@editor @editor_atto @atto @atto_underline @_bug_phantomjs Feature: Atto underline button To format text in Atto, I need to use the underline button. diff --git a/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature b/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature index 64d4f23eede..30a8b907bda 100644 --- a/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature +++ b/lib/editor/atto/plugins/unorderedlist/tests/behat/unorderedlist.feature @@ -1,4 +1,4 @@ -@atto @atto_unorderedlist @_bug_phantomjs +@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.