Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / spelling / inline_spelling_markers.html
blobf9aed711849ef44bc383e450df3ca6b488471b58
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script src="../../editing/editing.js"></script>
5 <style>
6 body { overflow:hidden; }
8 .testDiv {
9 width: 200px;
10 height: 20px;
11 border: 1px solid black;
12 white-space: nowrap;
13 overflow: hidden;
16 .forcertl {
17 direction: rtl;
18 unicode-bidi: bidi-override;
21 .ellipses {
22 text-overflow:ellipsis;
25 </style>
27 </head>
28 <body>
29 <script>
30 description("This tests the correct placement of inline spelling and grammar "
31 + "markers in text. Spelling markers should line up exactly under misspelled "
32 + "words in all cases.");
34 jsTestIsAsync = true;
36 if (window.internals) {
37 internals.settings.setUnifiedTextCheckerEnabled(true);
38 internals.settings.setAsynchronousSpellCheckingEnabled(true);
41 if (window.testRunner)
42 testRunner.dumpAsTextWithPixelResults();
44 </script>
46 LTR
47 <div id="testLTR" class="testDiv" contenteditable="true">the the adlj adaasj sdklj. there there</div>
49 RTL
50 <div id="testRTL" class="testDiv forcertl" contenteditable="true">the the adlj adaasj sdklj. there there</div>
52 LTR (text-overflow:ellipses):
53 <div id="testLTREllipses" class="testDiv ellipses" contenteditable="true">the the adlj adaasj sdklj. there there</div>
55 RTL (text-overflow:ellipses):
56 <div id="testRTLEllipses" class="testDiv forcertl ellipses" contenteditable="true">the the adlj adaasj sdklj. there there</div>
58 <script>
59 function moveCursorOverAllWords(id)
61 div = document.getElementById(id);
62 div.focus();
64 debug(id + ":");
65 // Move cursor over all words so inline spellchecking is activated for all.
66 for (var i = 0; i < div.innerHTML.length; i++)
67 moveSelectionForwardByWordCommand();
69 verifyMarkers();
72 function verifyMarkers()
74 if (!window.internals)
75 return done();
77 // Take care of spelling markers first.
78 shouldBecomeEqual('internals.hasSpellingMarker(document, 8, 4)', 'true', function() { // Verifies 'adlj'.
79 shouldBecomeEqual('internals.hasSpellingMarker(document, 13, 6)', 'true', function() { // Verifies 'adaasj'.
80 shouldBecomeEqual('internals.hasSpellingMarker(document, 20, 5)', 'true', verifyGrammarMarkers) // Verifies 'sdklj'.
82 });
84 function verifyGrammarMarkers() {
85 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', function() { // Verifies second 'the'.
86 shouldBecomeEqual('internals.hasGrammarMarker(document, 33, 5)', 'true', function() { // Verifies second 'there'.
87 // Markers of next element can not be found after modification selection without blur event.
88 div.blur();
89 done();
91 });
95 var tests = [ function() { moveCursorOverAllWords('testLTR'); },
96 function() { moveCursorOverAllWords('testRTL'); },
97 function() { moveCursorOverAllWords('testLTREllipses'); },
98 function() { moveCursorOverAllWords('testRTLEllipses'); } ];
100 function done()
102 var next = tests.shift();
103 if (next)
104 return window.setTimeout(next, 0);
106 finishJSTest();
108 done();
109 </script>
110 </body>
111 </html>