Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / spelling / spelling-linebreak.html
1 <html> 
2 <head>
3
4 <style>
5 .editing { 
6     border: 2px solid red; 
7     padding: 12px; 
8     font-size: 24px; 
9 }
10 </style>
11 <script src="../../resources/js-test.js"></script>
12 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
13
14 <script>
15
16 jsTestIsAsync = true;
17
18 if (window.internals) {
19     internals.settings.setUnifiedTextCheckerEnabled(true);
20     internals.settings.setAsynchronousSpellCheckingEnabled(true);
21 }
22
23 function editingTest() {
24
25     var elem = document.getElementById("test");
26     var selection = window.getSelection();
27     selection.collapse(elem, elem.childNodes.length);
28
29     typeCharacterCommand('z');
30     typeCharacterCommand('z');
31     typeCharacterCommand(' ');
32     typeCharacterCommand('a');
33     typeCharacterCommand(' ');
34     typeCharacterCommand('a');
35     moveSelectionBackwardByWordCommand();
36     insertLineBreakCommand();
37
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         });
44     }
45
46 }
47
48 </script>
49
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>