blob: c9b3d139f41f150bcd47bade892e90f1af9177a6 [file] [log] [blame]
<html>
<head>
<style>
.editing {
border: 2px solid red;
padding: 12px;
font-size: 24px;
}
</style>
<script src="../../resources/js-test.js"></script>
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
jsTestIsAsync = true;
if (window.internals)
internals.settings.setUnifiedTextCheckerEnabled(true);
function editingTest() {
var elem = document.getElementById("test");
var selection = window.getSelection();
selection.collapse(elem, elem.childNodes.length);
typeCharacterCommand('z');
typeCharacterCommand('z');
typeCharacterCommand(' ');
typeCharacterCommand('a');
typeCharacterCommand(' ');
typeCharacterCommand('a');
moveSelectionBackwardByWordCommand();
insertLineBreakCommand();
if (window.testRunner) {
selection.collapse(elem, 0);
shouldBecomeEqual("internals.hasSpellingMarker(document, 6, 2)", "true", function() {
document.getElementById("root").style.display = "none";
finishJSTest();
});
}
}
</script>
<title>Editing Test</title>
</head>
<body>
<script>
description("Misspellings should be preserved when a line-break command "
+ "splits a text node. You should see 'Hello,zz a' on the first line below, "
+ "and 'a' on the second line. "
+ "This test succeeds when 'zz' (and only 'zz') is marked as misspelled.");
</script>
<div contenteditable id="root" class="editing">
<!-- we need to lead "Hello," to preserve the marker even after collapse() -->
<span id="test">Hello,</span>
</div>
<script>
editingTest();
</script>
</body>
</html>