commit bb0a1dc041c8f8aa7f4482982f740fdfb240f34d parent 390c996054a11e711f474205c42f58175e115c2e Author: Masayuki Nakano <masayuki@d-toybox.com> Date: Wed, 24 Dec 2025 02:05:51 +0000 Bug 2007052 - part 4: Port the remaining tests of `test_bug430392.html` to WPT r=m_kato Differential Revision: https://phabricator.services.mozilla.com/D277262 Diffstat:
32 files changed, 192 insertions(+), 135 deletions(-)
diff --git a/editor/libeditor/tests/mochitest.toml b/editor/libeditor/tests/mochitest.toml @@ -81,8 +81,6 @@ skip-if = [ ["test_bug426246.html"] -["test_bug430392.html"] - ["test_bug439808.html"] ["test_bug442186.html"] diff --git a/editor/libeditor/tests/test_bug430392.html b/editor/libeditor/tests/test_bug430392.html @@ -1,128 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=430392 ---> -<head> - <title>Test for Bug 430392</title> - <script src="/tests/SimpleTest/SimpleTest.js"></script> - <script src="/tests/SimpleTest/EventUtils.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=430392">Mozilla Bug 430392</a> -<p id="display"></p> -<div id="content"> - <div contenteditable="true" id="edit"> <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> </div> -</div> -<pre id="test"> -<script class="testbody" type="text/javascript"> - -/** Test for Bug 430392 */ - -function test() { - var edit = document.getElementById("edit"); - var html = edit.innerHTML; - var expectedText = edit.textContent; - document.getElementById("edit").focus(); - - // Each test is [desc, callback, inputType of `beforeinput`, inputType of `input`]. - // callback() is called and we check that the textContent didn't change. - // For expected failures, the format is - // [desc, callback, undefined, inputType of `beforeinput`, inputType of `input`, expectedValue], - // and the test will be marked as an expected fail if the textContent changes - // to expectedValue, and an unexpected fail if it's neither the original value - // nor expectedValue. - let tests = []; - // These are all TODO -- they don't move the non-editable elements - [ - ["bold", "formatBold"], - ["italic", "formatItalic"], - ["underline", "formatUnderline"], - ["strikethrough", "formatStrikeThrough"], - ["subscript", "formatSubscript"], - ["superscript", "formatSuperscript"], - ["forecolor", "formatFontColor", "blue"], - ["backcolor", "formatBackColor", "blue"], - ["hilitecolor", "formatBackColor", "blue"], - ["fontname", "formatFontName", "monospace"], - ["fontsize", "", "1"], - ["justifyright", "formatJustifyRight"], - ["justifycenter", "formatJustifyCenter"], - ["justifyfull", "formatJustifyFull"], - ].forEach(item => { - let cmd = item[0]; - let param = item[2]; - let inputType = item[1]; - tests.push([cmd, () => { document.execCommand(cmd, false, param); }, - [/* execCommand shouldn't cause beforeinput event */], - [inputType], - " A ; ; BC "]); - }); - - let beforeinputTypes = []; - let inputTypes = []; - edit.addEventListener("beforeinput", event => { beforeinputTypes.push(event.inputType); }); - edit.addEventListener("input", event => { inputTypes.push(event.inputType); }); - tests.forEach(arr => { - ["div", "br", "p"].forEach(sep => { - document.execCommand("defaultParagraphSeparator", false, sep); - - let expectedFailText = typeof arr[4] == "function" ? arr[4](sep) : arr[4]; - - edit.innerHTML = html; - edit.focus(); - getSelection().selectAllChildren(edit); - beforeinputTypes = []; - inputTypes = []; - arr[1](); - const resultText = edit.textContent; - if (expectedFailText !== undefined) { - todo_is(resultText, expectedText, `${arr[0]} should not change text (${sep})`); - if (resultText !== expectedText && resultText !== expectedFailText) { - is( - resultText.replaceAll(/\u00A0/g, " "), - expectedFailText.replaceAll(/\u00A0/g, " "), - `${arr[0]} changed to different failure (${sep})` - ); - } - } else { - is( - resultText.replaceAll(/\u00A0/g, " "), - expectedText.replaceAll(/\u00A0/g, " "), - `${arr[0]} should not change text (${sep})` - ); - } - is(beforeinputTypes.length, arr[2].length, `${arr[0]}: number of beforeinput events should be ${arr[2].length} (${sep})`); - for (let i = 0; i < Math.max(beforeinputTypes.length, arr[2].length); i++) { - if (i < beforeinputTypes.length && i < arr[2].length) { - is(beforeinputTypes[i], arr[2][i], `${arr[0]}: ${i + 1}th inputType of beforeinput event should be "${arr[2][i]}" (${sep})`); - } else if (i < beforeinputTypes.length) { - ok(false, `${arr[0]}: Redundant beforeinput event shouldn't be fired, its inputType was "${beforeinputTypes[i]}" (${sep})`); - } else { - ok(false, `${arr[0]}: beforeinput event whose inputType is "${arr[2][i]}" should be fired, but not fired (${sep})`); - } - } - is(inputTypes.length, arr[3].length, `${arr[0]}: number of input events is unexpected (${sep})`); - for (let i = 0; i < Math.max(inputTypes.length, arr[3].length); i++) { - if (i < inputTypes.length && i < arr[3].length) { - is(inputTypes[i], arr[3][i], `${arr[0]}: ${i + 1}th inputType of input event should be "${arr[3][i]}" (${sep})`); - } else if (i < inputTypes.length) { - ok(false, `${arr[0]}: Redundant input event shouldn't be fired, its inputType was "${inputTypes[i]}" (${sep})`); - } else { - ok(false, `${arr[0]}: input event whose inputType is "${arr[3][i]}" should be fired, but not fired (${sep})`); - } - } - }); - }); - - SimpleTest.finish(); -} - -SimpleTest.waitForExplicitFinish(); -SimpleTest.waitForFocus(test); - -</script> -</pre> -</body> -</html> diff --git a/testing/web-platform/meta/editing/run/backcolor.html.ini b/testing/web-platform/meta/editing/run/backcolor.html.ini @@ -67,3 +67,6 @@ [[["stylewithcss","false"\],["backcolor","#00FFFF"\]\] "<span style=background-color:tan>fo[o</span><span style=background-color:yellow>b\]ar</span>" queryCommandIndeterm("backcolor") before] expected: FAIL + + [[["stylewithcss","false"\],["backcolor","#00FFFF"\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/bold.html.ini b/testing/web-platform/meta/editing/run/bold.html.ini @@ -261,3 +261,6 @@ [[["stylewithcss","false"\],["bold",""\]\] "<span style=font-weight:100>fo[o</span><span style=font-weight:200>b\]ar</span>" queryCommandState("bold") after] expected: FAIL + + [[["stylewithcss","false"\],["bold",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/fontname.html.ini b/testing/web-platform/meta/editing/run/fontname.html.ini @@ -101,3 +101,6 @@ [fontname.html?2001-last] [[["stylewithcss","false"\],["fontname","sans-serif"\]\] "fo[o<listing>b\]ar</listing>" queryCommandValue("fontname") after] expected: FAIL + + [[["stylewithcss","false"\],["fontname","sans-serif"\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/fontsize.html.ini b/testing/web-platform/meta/editing/run/fontsize.html.ini @@ -686,3 +686,6 @@ [[["stylewithcss","false"\],["fontsize","4"\]\] "<font size=6>fo[o</font><span style=font-size:xx-large>b\]ar</span>" queryCommandIndeterm("fontsize") before] expected: FAIL + + [[["stylewithcss","false"\],["fontsize","5"\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/forecolor.html.ini b/testing/web-platform/meta/editing/run/forecolor.html.ini @@ -101,3 +101,6 @@ [[["stylewithcss","false"\],["forecolor","#0000FF"\]\] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b\]ar</span>" compare innerHTML] expected: FAIL + + [[["stylewithcss","false"\],["foreColor","#ff0000"\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/hilitecolor.html.ini b/testing/web-platform/meta/editing/run/hilitecolor.html.ini @@ -69,3 +69,6 @@ [[["stylewithcss","false"\],["hilitecolor","#00FFFF"\]\] "<span style=background-color:tan>fo[o</span><span style=background-color:yellow>b\]ar</span>" queryCommandIndeterm("hilitecolor") before] expected: FAIL + + [[["stylewithcss","false"\],["hilitecolor","#00FFFF"\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/italic.html.ini b/testing/web-platform/meta/editing/run/italic.html.ini @@ -293,3 +293,6 @@ [[["stylewithcss","false"\],["italic",""\]\] "<i>fo[o</i><address>b\]ar</address>" queryCommandIndeterm("italic") after] expected: FAIL + + [[["stylewithcss","false"\],["italic",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/justifycenter.html.ini b/testing/web-platform/meta/editing/run/justifycenter.html.ini @@ -1539,3 +1539,6 @@ [[["stylewithcss","false"\],["defaultparagraphseparator","p"\],["justifycenter",""\]\] "<center><p>foo</center> <p>[bar\]</p> <center><p>baz</center>" compare innerHTML] expected: FAIL + + [[["stylewithcss","true"\],["defaultparagraphseparator","div"\],["justifycenter",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/justifyfull.html.ini b/testing/web-platform/meta/editing/run/justifyfull.html.ini @@ -1099,3 +1099,6 @@ [[["defaultparagraphseparator","p"\],["justifyfull",""\]\] "<div align=justify><p>foo</div> <p>[bar\]</p> <div align=justify><p>baz</div>" compare innerHTML] expected: FAIL + + [[["stylewithcss","true"\],["defaultparagraphseparator","div"\],["justifyfull",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/justifyleft.html.ini b/testing/web-platform/meta/editing/run/justifyleft.html.ini @@ -524,3 +524,6 @@ [[["justifyleft",""\]\] "<div align=left><p>foo</div> <p>[bar\]</p> <div align=left><p>baz</div>" compare innerHTML] expected: FAIL + + [[["stylewithcss","true"\],["justifyleft",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/justifyright.html.ini b/testing/web-platform/meta/editing/run/justifyright.html.ini @@ -1108,3 +1108,6 @@ [[["defaultparagraphseparator","p"\],["justifyright",""\]\] "<div align=right><p>foo</div> <p>[bar\]</p> <div align=right><p>baz</div>" compare innerHTML] expected: FAIL + + [[["stylewithcss","true"\],["defaultparagraphseparator","div"\],["justifyright",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/strikethrough.html.ini b/testing/web-platform/meta/editing/run/strikethrough.html.ini @@ -164,3 +164,6 @@ [[["strikethrough",""\]\] "fo[o<span style=text-decoration:line-through>b\]ar</span>baz" compare innerHTML] expected: FAIL + + [[["stylewithcss","false"\],["strikethrough",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/subscript.html.ini b/testing/web-platform/meta/editing/run/subscript.html.ini @@ -156,3 +156,6 @@ [[["stylewithcss","false"\],["subscript",""\]\] "foo<sup>b<sub>[a\]</sub>r</sup>baz" queryCommandState("subscript") after] expected: FAIL + + [[["stylewithcss","false"\],["subscript",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/superscript.html.ini b/testing/web-platform/meta/editing/run/superscript.html.ini @@ -162,3 +162,6 @@ [[["stylewithcss","false"\],["superscript",""\]\] "foo<sup>[bar\]<br></sup>" compare innerHTML] expected: FAIL + + [[["stylewithcss","false"\],["superscript",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/meta/editing/run/underline.html.ini b/testing/web-platform/meta/editing/run/underline.html.ini @@ -131,3 +131,6 @@ [[["stylewithcss","true"\],["underline",""\]\] "<u>fo[o</u><ins>b\]ar</ins>" compare innerHTML] expected: FAIL + + [[["stylewithcss","false"\],["underline",""\]\] "{ <span contenteditable=\\"false\\">A</span> ; <span contenteditable=\\"false\\">B</span> ; <span contenteditable=\\"false\\">C</span> }" compare innerHTML] + expected: FAIL diff --git a/testing/web-platform/tests/editing/data/backcolor.js b/testing/web-platform/tests/editing/data/backcolor.js @@ -349,5 +349,13 @@ var browserTests = [ [["stylewithcss","false"],["backcolor","#00FFFF"]], "<span style=\"background-color:rgb(210, 180, 140)\">fo<span style=\"background-color:rgb(0, 255, 255)\">[o</span><span style=\"background-color:rgba(0, 0, 0, 0)\"><span style=\"background-color:rgb(0, 255, 255)\">b]</span>ar</span></span>", [true,true], - {"stylewithcss":[false,true,"",false,false,""],"backcolor":[false,false,"rgb(210, 180, 140)",false,false,"rgb(0, 255, 255)"]}] + {"stylewithcss":[false,true,"",false,false,""],"backcolor":[false,false,"rgb(210, 180, 140)",false,false,"rgb(0, 255, 255)"]}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <span> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["backcolor","#00FFFF"]], + ' <span contenteditable="false">A</span><span style="background-color:rgb(0, 255, 255)"> ; </span><span contenteditable="false">B</span><span style="background-color:rgb(0, 255, 255)"> ; </span><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/bold.js b/testing/web-platform/tests/editing/data/bold.js @@ -1072,4 +1072,12 @@ var browserTests = [ "abc<i><b>def</b></i>ghi", [true,true], {}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <b> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["bold",""]], + ' <span contenteditable="false">A</span><b> ; </b><span contenteditable="false">B</span><b> ; </b><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/fontname.js b/testing/web-platform/tests/editing/data/fontname.js @@ -750,4 +750,12 @@ var browserTests = [ "<font color=\"#ff0000\">ab<font face=\"monospace\">[c]</font></font>", [true,true], {}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <font> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["fontname","sans-serif"]], + ' <span contenteditable="false">A</span><font face="sans-serif"> ; </font><span contenteditable="false">B</span><font face="sans-serif"> ; </font><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/fontsize.js b/testing/web-platform/tests/editing/data/fontsize.js @@ -862,4 +862,12 @@ var browserTests = [ "<p><font size=\"5\"><span style=\"background-color:rgb(0, 128, 128)\">[abc</span></font></p><p><font size=\"5\"><span style=\"background-color:rgb(128, 128, 0)\">def]</span></font></p>"], [true,true], {}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <font> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["fontsize","5"]], + ' <span contenteditable="false">A</span><font size="5"> ; </font><span contenteditable="false">B</span><font size="5"> ; </font><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/forecolor.js b/testing/web-platform/tests/editing/data/forecolor.js @@ -834,4 +834,12 @@ var browserTests = [ "a<span style=\"color:rgba(0, 0, 0, 0)\">b</span>c", [true,true,true,true], {}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <font> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["foreColor","#ff0000"]], + ' <span contenteditable="false">A</span><font color="#ff0000"> ; </font><span contenteditable="false">B</span><font color="#ff0000"> ; </font><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/hilitecolor.js b/testing/web-platform/tests/editing/data/hilitecolor.js @@ -411,5 +411,13 @@ var browserTests = [ [["stylewithcss","false"],["hilitecolor","#00FFFF"]], "<span style=\"background-color:rgb(0, 255, 255)\">[foo<span style=\"font-size:xx-large\">bar</span>baz]</span>", [true,true], - {"stylewithcss":[false,true,"",false,false,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}] + {"stylewithcss":[false,true,"",false,false,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <span> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["hilitecolor","#00FFFF"]], + ' <span contenteditable="false">A</span><span style="background-color:rgb(0, 255, 255)"> ; </span><span contenteditable="false">B</span><span style="background-color:rgb(0, 255, 255)"> ; </span><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/italic.js b/testing/web-platform/tests/editing/data/italic.js @@ -676,5 +676,13 @@ var browserTests = [ [["stylewithcss","false"],["italic",""]], "<i>fo</i>[o<address><span style=\"font-style:normal\">b]</span>ar</address>", [true,true], - {"stylewithcss":[false,true,"",false,false,""],"italic":[false,true,"",false,false,""]}] + {"stylewithcss":[false,true,"",false,false,""],"italic":[false,true,"",false,false,""]}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <i> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["italic",""]], + ' <span contenteditable="false">A</span><i> ; </i><span contenteditable="false">B</span><i> ; </i><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/justifycenter.js b/testing/web-platform/tests/editing/data/justifycenter.js @@ -1488,4 +1488,20 @@ var browserTests = [ "justifycenter":[false,true,"center",false,true,"center"], "justifyfull":[false,false,"center",false,false,"center"], "justifyright":[false,false,"center",false,false,"center"]}], + +// Firefox puts the new <div> at first editable/visible point and Chrome puts the +// new <div> at start of the selection first. +// Then, Firefox moves all editable nodes in the range into the new block. However, +// Chrome does not move anything. Safari just deletes editable nodes in the range. +// For here, these test expects that browsers wrap all selected things into the new +// block since non-editable nodes are removable, so, they should be movable too and +// Firefox and Chrome behave so for "insertOrderedList" and "insertUnorderedList". +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","true"],["defaultparagraphseparator","div"],["justifycenter",""]], + ['<div style="text-align:center"> <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> </div>', + // It's fine to ignore or delete the invisible whitespaces. + ' <div style="text-align:center"><span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span></div> ', + '<div style="text-align:center"><span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span></div>'], + [true,true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/justifyfull.js b/testing/web-platform/tests/editing/data/justifyfull.js @@ -1164,5 +1164,21 @@ var browserTests = [ [["defaultparagraphseparator","p"],["justifyfull",""]], "<div align=\"justify\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>", [true,true], - {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"justifyfull":[false,false,"left",false,true,"justify"]}] + {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"justifyfull":[false,false,"left",false,true,"justify"]}], + +// Firefox puts the new <div> at first editable/visible point and Chrome puts the +// new <div> at start of the selection first. +// Then, Firefox moves all editable nodes in the range into the new block. However, +// Chrome does not move anything. Safari just deletes editable nodes in the range. +// For here, these test expects that browsers wrap all selected things into the new +// block since non-editable nodes are removable, so, they should be movable too and +// Firefox and Chrome behave so for "insertOrderedList" and "insertUnorderedList". +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","true"],["defaultparagraphseparator","div"],["justifyfull",""]], + ['<div style="text-align:justify"> <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> </div>', + // It's fine to ignore or delete the invisible whitespaces. + ' <div style="text-align:justify"><span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span></div> ', + '<div style="text-align:justify"><span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span></div>'], + [true,true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/justifyleft.js b/testing/web-platform/tests/editing/data/justifyleft.js @@ -763,4 +763,10 @@ var browserTests = [ "justifycenter":[false,false,"left",false,false,"left"], "justifyfull":[false,false,"left",false,false,"left"], "justifyright":[false,false,"left",false,false,"left"]}], + +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","true"],["justifyleft",""]], + ' <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/justifyright.js b/testing/web-platform/tests/editing/data/justifyright.js @@ -1183,4 +1183,20 @@ var browserTests = [ "justifycenter":[false,false,"right",false,false,"right"], "justifyfull":[false,false,"right",false,false,"right"], "justifyright":[false,true,"right",false,true,"right"]}], + +// Firefox puts the new <div> at first editable/visible point and Chrome puts the +// new <div> at start of the selection first. +// Then, Firefox moves all editable nodes in the range into the new block. However, +// Chrome does not move anything. Safari just deletes editable nodes in the range. +// For here, these test expects that browsers wrap all selected things into the new +// block since non-editable nodes are removable, so, they should be movable too and +// Firefox and Chrome behave so for "insertOrderedList" and "insertUnorderedList". +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","true"],["defaultparagraphseparator","div"],["justifyright",""]], + ['<div style="text-align:right"> <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> </div>', + // It's fine to ignore or delete the invisible whitespaces. + ' <div style="text-align:right"><span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span></div> ', + '<div style="text-align:right"><span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span></div>'], + [true,true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/strikethrough.js b/testing/web-platform/tests/editing/data/strikethrough.js @@ -768,4 +768,12 @@ var browserTests = [ "abc<span style=\"text-decoration-line:underline\">[def]</span>ghi"], [true,true], {}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <strike> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["strikethrough",""]], + ' <span contenteditable="false">A</span><strike> ; </strike><span contenteditable="false">B</span><strike> ; </strike><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/subscript.js b/testing/web-platform/tests/editing/data/subscript.js @@ -428,4 +428,12 @@ var browserTests = [ "foo<sub>[bar]</sub>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <sub> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["subscript",""]], + ' <span contenteditable="false">A</span><sub> ; </sub><span contenteditable="false">B</span><sub> ; </sub><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/superscript.js b/testing/web-platform/tests/editing/data/superscript.js @@ -439,5 +439,13 @@ var browserTests = [ [["stylewithcss","false"],["superscript",""]], "foo[bar]<br>", [true,true], - {"stylewithcss":[false,true,"",false,false,""],"superscript":[false,true,"",false,false,""]}] + {"stylewithcss":[false,true,"",false,false,""],"superscript":[false,true,"",false,false,""]}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <sup> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["superscript",""]], + ' <span contenteditable="false">A</span><sup> ; </sup><span contenteditable="false">B</span><sup> ; </sup><span contenteditable="false">C</span> ', + [true,true], + {}], ] diff --git a/testing/web-platform/tests/editing/data/underline.js b/testing/web-platform/tests/editing/data/underline.js @@ -760,4 +760,12 @@ var browserTests = [ "abc<span style=\"text-decoration-line:line-through\">[def]</span>ghi"], [true,true], {}], + +// Should not change the style of the non-editable nodes so that only the +// visible and editable nodes are wrapped into the <u> elements. +['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', + [["stylewithcss","false"],["underline",""]], + ' <span contenteditable="false">A</span><u> ; </u><span contenteditable="false">B</span><u> ; </u><span contenteditable="false">C</span> ', + [true,true], + {}], ] \ No newline at end of file