Modified: trunk/LayoutTests/editing/pasteboard/paste-and-sanitize.html (251464 => 251465)
--- trunk/LayoutTests/editing/pasteboard/paste-and-sanitize.html 2019-10-22 22:59:20 UTC (rev 251464)
+++ trunk/LayoutTests/editing/pasteboard/paste-and-sanitize.html 2019-10-23 00:33:03 UTC (rev 251465)
@@ -2,6 +2,7 @@
<html>
<head>
<script src=""
+<script src=""
</head>
<body>
<p id="description">This test checks that the paste operation trims the pasted fragment to reduce the verbosity of the markup without affecting the style. </p>
@@ -20,7 +21,7 @@
return node;
}
-function testPaste(tagName, originalMarkup, expected) {
+async function testPaste(tagName, originalMarkup, expected) {
var node = createEditable(tagName, originalMarkup);
root.appendChild(node);
@@ -27,7 +28,10 @@
node.focus();
document.execCommand("SelectAll", false);
document.execCommand("Copy", false);
+ await UIHelper.ensurePresentationUpdate();
+
document.execCommand("Paste", false);
+ await UIHelper.ensurePresentationUpdate();
confirmedMarkup = node.innerHTML;
@@ -34,22 +38,29 @@
shouldBe("confirmedMarkup", "'" + expected + "'");
}
-testPaste("div", "Hello", "Hello");
-testPaste("div", "<b><i>Hello</i></b>", "<b><i>Hello</i></b>");
-testPaste("div", "<div><b><i><span style=\"font-weight: normal\"><b><i>Hello</i></b></span></i></b></div>", "<b><i>Hello</i></b>");
-testPaste("div", "<div><div><div>Hello</div></div></div>", "Hello");
-testPaste("div", "<div><b><div><i>Hello</i></div></b></div>", "<i style=\"font-weight: bold;\">Hello</i>");
-testPaste("div", "<div><div style=\"text-align: center;\"><b>Hello</b></div></div>", "<div style=\"text-align: center;\"><b>Hello</b></div>");
-testPaste("div", "<div><b><i><span style=\"font-weight: normal\"><b><i>hello</i></b></span></i></b></div><div><b><i><span style=\"font-weight: normal\"><b><i>world</i></b></span></i></b></div>",
- "<div><b><i>hello</i></b></div><div><b><i>world</i></b></div>");
-testPaste("div", "<div><b><i><span style=\"font-weight: normal;\"><b><i>hello1</i></b><b><i> hello2</i></b></span></i></b></div>", "<b><i><span style=\"font-weight: normal;\"><b><i>hello1</i></b><b><i> hello2</i></b></span></i></b>");
-testPaste("div", "<i style=\"margin: 10px;\"><b><i style=\"margin: 10px;\">hello</i></b></i>",
- "<i style=\"margin: 10px;\">hello</i></b></i>");
-testPaste("div", "<div><b><i><span style=\"font-weight: normal\"><b><i>Hello <!-- comment -->world</i></b></span></i></b></div>", "<b><i>Hello world</i></b>");
-testPaste("div", "<div><b><i><span style=\"font-weight: normal\">plain text<b><i>bold italic text</i></b></span></i></b></div>", "<b><i><span style=\"font-weight: normal;\">plain text<b><i>bold italic text</i></b></span></i></b>");
+jsTestIsAsync = true;
-root.style.display = "none";
+async function runTest() {
+ await testPaste("div", "Hello", "Hello");
+ await testPaste("div", "<b><i>Hello</i></b>", "<b><i>Hello</i></b>");
+ await testPaste("div", "<div><b><i><span style=\"font-weight: normal\"><b><i>Hello</i></b></span></i></b></div>", "<b><i>Hello</i></b>");
+ await testPaste("div", "<div><div><div>Hello</div></div></div>", "Hello");
+ await testPaste("div", "<div><b><div><i>Hello</i></div></b></div>", "<i style=\"font-weight: bold;\">Hello</i>");
+ await testPaste("div", "<div><div style=\"text-align: center;\"><b>Hello</b></div></div>", "<div style=\"text-align: center;\"><b>Hello</b></div>");
+ await testPaste("div", "<div><b><i><span style=\"font-weight: normal\"><b><i>hello</i></b></span></i></b></div><div><b><i><span style=\"font-weight: normal\"><b><i>world</i></b></span></i></b></div>",
+ "<div><b><i>hello</i></b></div><div><b><i>world</i></b></div>");
+ await testPaste("div", "<div><b><i><span style=\"font-weight: normal;\"><b><i>hello1</i></b><b><i> hello2</i></b></span></i></b></div>", "<b><i><span style=\"font-weight: normal;\"><b><i>hello1</i></b><b><i> hello2</i></b></span></i></b>");
+ await testPaste("div", "<i style=\"margin: 10px;\"><b><i style=\"margin: 10px;\">hello</i></b></i>",
+ "<i style=\"margin: 10px;\">hello</i></b></i>");
+ await testPaste("div", "<div><b><i><span style=\"font-weight: normal\"><b><i>Hello <!-- comment -->world</i></b></span></i></b></div>", "<b><i>Hello world</i></b>");
+ await testPaste("div", "<div><b><i><span style=\"font-weight: normal\">plain text<b><i>bold italic text</i></b></span></i></b></div>", "<b><i><span style=\"font-weight: normal;\">plain text<b><i>bold italic text</i></b></span></i></b>");
+ root.style.display = "none";
+
+ finishJSTest();
+}
+
+addEventListener("load", runTest);
</script>
<script src=""
</body>