Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/inline_spelling_markers.html

Issue 2736823002: Move tests in editing/spelling for marker appearance to paint/spellmarkers (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <style>
5 body { overflow:hidden; }
6
7 .testDiv {
8 width: 200px;
9 height: 20px;
10 border: 1px solid black;
11 white-space: nowrap;
12 overflow: hidden;
13 }
14
15 .forcertl {
16 direction: rtl;
17 unicode-bidi: bidi-override;
18 }
19
20 .ellipses {
21 text-overflow:ellipsis;
22 }
23
24 </style>
25 </head>
26 <body>
27 <div id="warning">
28 This test requires window.internals. If you use content_shell,
29 "--expose-internals-for-testing" command flag enables it.
30 </div>
31
32 LTR
33 <div id="testLTR" class="testDiv" contenteditable="true">the the adlj adaasj sdk lj. there there</div>
34
35 RTL
36 <div id="testRTL" class="testDiv forcertl" contenteditable="true">the the adlj a daasj sdklj. there there</div>
37
38 LTR (text-overflow:ellipses):
39 <div id="testLTREllipses" class="testDiv ellipses" contenteditable="true">the th e adlj adaasj sdklj. there there</div>
40
41 RTL (text-overflow:ellipses):
42 <div id="testRTLEllipses" class="testDiv forcertl ellipses" contenteditable="tru e">the the adlj adaasj sdklj. there there</div>
43
44 <script>
45 if (window.internals)
46 document.getElementById('warning').style.display = 'none';
47
48 // This tests the correct placement of inline spelling and grammar markers in
49 // text. Markers should line up exactly under misspelled words in all cases.
50
51 // 'adlj', adaasj', 'sdklj'.
52 const spellingMarkerRanges = [[8, 4], [13, 6], [20, 5]];
53
54 // 'the', 'there'.
55 const grammarMarkerRanges = [[4, 3], [33, 5]];
56
57 ['testLTR', 'testRTL', 'testLTREllipses', 'testRTLEllipses'].forEach(id => {
58 const div = document.getElementById(id);
59 const text = div.firstChild;
60
61 spellingMarkerRanges.forEach(markerRange => {
62 const range = document.createRange();
63 range.setStart(text, markerRange[0]);
64 range.setEnd(text, markerRange[0] + markerRange[1]);
65 if (window.internals)
66 internals.setMarker(document, range, 'spelling');
67 });
68
69 grammarMarkerRanges.forEach(markerRange => {
70 const range = document.createRange();
71 range.setStart(text, markerRange[0]);
72 range.setEnd(text, markerRange[0] + markerRange[1]);
73 if (window.internals)
74 internals.setMarker(document, range, 'grammar');
75 });
76 });
77 </script>
78 </body>
79 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698