Title: [254833] trunk/LayoutTests
- Revision
- 254833
- Author
- [email protected]
- Date
- 2020-01-20 12:24:54 -0800 (Mon, 20 Jan 2020)
Log Message
Add a test to verify that the callout bar appears after selecting a word
https://bugs.webkit.org/show_bug.cgi?id=206488
<rdar://problem/58661768>
Reviewed by Darin Adler.
* editing/selection/ios/show-callout-bar-after-selecting-word-expected.txt: Added.
* editing/selection/ios/show-callout-bar-after-selecting-word.html: Added.
Add the new layout test.
* resources/ui-helper.js:
(window.UIHelper.rectForMenuAction):
Wrap this UI script in its own function scope, such that it can be used multiple times in the same layout test.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (254832 => 254833)
--- trunk/LayoutTests/ChangeLog 2020-01-20 20:17:41 UTC (rev 254832)
+++ trunk/LayoutTests/ChangeLog 2020-01-20 20:24:54 UTC (rev 254833)
@@ -1,3 +1,21 @@
+2020-01-20 Wenson Hsieh <[email protected]>
+
+ Add a test to verify that the callout bar appears after selecting a word
+ https://bugs.webkit.org/show_bug.cgi?id=206488
+ <rdar://problem/58661768>
+
+ Reviewed by Darin Adler.
+
+ * editing/selection/ios/show-callout-bar-after-selecting-word-expected.txt: Added.
+ * editing/selection/ios/show-callout-bar-after-selecting-word.html: Added.
+
+ Add the new layout test.
+
+ * resources/ui-helper.js:
+ (window.UIHelper.rectForMenuAction):
+
+ Wrap this UI script in its own function scope, such that it can be used multiple times in the same layout test.
+
2020-01-20 Diego Pino Garcia <[email protected]>
[GTK] Gardening, remove expected to fail but pass
Added: trunk/LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word-expected.txt (0 => 254833)
--- trunk/LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word-expected.txt 2020-01-20 20:24:54 UTC (rev 254833)
@@ -0,0 +1,11 @@
+This test verifies that the callout bar is shown after selecting a word in an editable element using the callout bar. To test manually, focus the editable area and tap 'Select' in the callout bar; the callout bar should appear again, with an option to 'Copy'.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS Showed menu by tapping
+PASS Selected word using menu action
+PASS Callout bar contains 'Copy' action
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word.html (0 => 254833)
--- trunk/LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word.html (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word.html 2020-01-20 20:24:54 UTC (rev 254833)
@@ -0,0 +1,68 @@
+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<script src=""
+<script src=""
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+<style>
+body, html {
+ margin: 0;
+}
+
+div[contenteditable] {
+ border: 2px solid tomato;
+ width: 300px;
+ height: 300px;
+ box-sizing: border-box;
+ font-size: 32px;
+ padding: 10px;
+}
+
+#console, #description {
+ width: 300px;
+ height: 100px;
+ overflow: scroll;
+}
+</style>
+<script>
+jsTestIsAsync = true;
+
+async function waitUntilMenuContainsCopyAction() {
+ while (true) {
+ if (await UIHelper.rectForMenuAction("Copy"))
+ break;
+ await UIHelper.delayFor(100);
+ }
+}
+
+addEventListener("load", async () => {
+ if (!window.testRunner)
+ return;
+
+ description("This test verifies that the callout bar is shown after selecting a word in an editable element using the callout bar. To test manually, focus the editable area and tap 'Select' in the callout bar; the callout bar should appear again, with an option to 'Copy'.");
+
+ const editor = document.querySelector("div[contenteditable]");
+
+ await UIHelper.activateElementAndWaitForInputSession(editor);
+ await UIHelper.activateAt(250, 250);
+ await UIHelper.waitForMenuToShow();
+ testPassed("Showed menu by tapping");
+
+ await UIHelper.chooseMenuAction("Select");
+ await UIHelper.waitForSelectionToAppear();
+ testPassed("Selected word using menu action");
+
+ await waitUntilMenuContainsCopyAction();
+ testPassed("Callout bar contains 'Copy' action");
+
+ editor.remove();
+ finishJSTest();
+});
+</script>
+</head>
+<body>
+<div contenteditable>WebKit</div>
+<div id="description"></div>
+<div id="console"></div>
+</body>
+</html>
Modified: trunk/LayoutTests/resources/ui-helper.js (254832 => 254833)
--- trunk/LayoutTests/resources/ui-helper.js 2020-01-20 20:17:41 UTC (rev 254832)
+++ trunk/LayoutTests/resources/ui-helper.js 2020-01-20 20:24:54 UTC (rev 254833)
@@ -975,8 +975,10 @@
{
return new Promise(resolve => {
testRunner.runUIScript(`
- const rect = uiController.rectForMenuAction("${action}");
- uiController.uiScriptComplete(rect ? JSON.stringify(rect) : "");
+ (() => {
+ const rect = uiController.rectForMenuAction("${action}");
+ uiController.uiScriptComplete(rect ? JSON.stringify(rect) : "");
+ })();
`, stringResult => {
resolve(stringResult.length ? JSON.parse(stringResult) : null);
});
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes