blob: 7d195ef882c4d28c3fafe98a1629477b474d7bae [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="../../../resources/ui-helper.js"></script>
<script src="../../../resources/js-test.js"></script>
<style>
body, html {
width: 100%;
height: 100%;
margin: 0;
}
#editor {
width: 320px;
height: 200px;
border: solid 1px tomato;
margin-top: 100px;
}
.big {
font-size: 24px;
}
</style>
<script>
jsTestIsAsync = true;
if (window.testRunner) {
testRunner.setAllowedMenuActions(["Embiggen"]);
testRunner.installCustomMenuAction("Embiggen", false, () => document.querySelector("#editor").classList.add("big"));
}
addEventListener("load", runTest);
async function runTest() {
description("This test verifies that interacting with a menu action item on iOS that is marked with 'dontDismiss' does not cause the callout menu to dismiss, even if the action changes the selection. To test manually, select the text and tap an item in the callout menu that shouldn't automatically dismiss the menu but changes the selection rects (for instance, Bold). Verify that the callout menu remains visible after tapping this item.");
await UIHelper.activateElementAndWaitForInputSession(editor);
await UIHelper.keyDown("a", ["metaKey"]);
await UIHelper.waitForMenuToShow();
await UIHelper.chooseMenuAction("Embiggen");
selectionRects = null;
while (!selectionRects || selectionRects.length != 2)
selectionRects = await UIHelper.getUISelectionViewRects();
dismissingMenu = await UIHelper.isDismissingMenu();
showingMenu = await UIHelper.isShowingMenu();
shouldBe("selectionRects[0].top", "101");
shouldBe("selectionRects[0].width", "320");
shouldBe("selectionRects[0].left", "1");
shouldBe("selectionRects[0].height", "29");
shouldBe("selectionRects[1].top", "130");
shouldBe("selectionRects[1].width", "172");
shouldBe("selectionRects[1].left", "1");
shouldBe("selectionRects[1].height", "30");
shouldBe("dismissingMenu", "false");
shouldBe("showingMenu", "true");
finishJSTest();
}
</script>
</head>
<body>
<div id="editor" contenteditable>The quick brown fox jumped over the lazy dog.</div>
<div id="description"></div>
<div id="console"></div>
</body>
</html>