Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / spelling / spelling-linebreak.html
blobca2157fe4d9e1fc96723061b3b6e22369fc1d536
1 <html>
2 <head>
4 <style>
5 .editing {
6 border: 2px solid red;
7 padding: 12px;
8 font-size: 24px;
10 </style>
11 <script src="../../resources/js-test.js"></script>
12 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
14 <script>
16 jsTestIsAsync = true;
18 if (window.internals) {
19 internals.settings.setUnifiedTextCheckerEnabled(true);
20 internals.settings.setAsynchronousSpellCheckingEnabled(true);
23 function editingTest() {
25 var elem = document.getElementById("test");
26 var selection = window.getSelection();
27 selection.collapse(elem, elem.childNodes.length);
29 typeCharacterCommand('z');
30 typeCharacterCommand('z');
31 typeCharacterCommand(' ');
32 typeCharacterCommand('a');
33 typeCharacterCommand(' ');
34 typeCharacterCommand('a');
35 moveSelectionBackwardByWordCommand();
36 insertLineBreakCommand();
38 if (window.testRunner) {
39 selection.collapse(elem, 0);
40 shouldBecomeEqual("internals.hasSpellingMarker(document, 6, 2)", "true", function() {
41 document.getElementById("root").style.display = "none";
42 finishJSTest();
43 });
48 </script>
50 <title>Editing Test</title>
51 </head>
52 <body>
53 <script>
54 description("Misspellings should be preserved when a line-break command "
55 + "splits a text node. You should see 'Hello,zz a' on the first line below, "
56 + "and 'a' on the second line. "
57 + "This test succeeds when 'zz' (and only 'zz') is marked as misspelled.");
58 </script>
59 <div contenteditable id="root" class="editing">
60 <!-- we need to lead "Hello," to preserve the marker even after collapse() -->
61 <span id="test">Hello,</span>
62 </div>
63 <script>
64 editingTest();
65 </script>
66 </body>
67 </html>