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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/modify_extend/extend_by_character.html

Issue 2184953002: Convert extend-by-character-[1-6].html to use assert_selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-28T10:36:48 Adopt to Linux behavior Created 4 years, 4 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 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <script src="../../assert_selection.js"></script>
5 <script>
6 const isLinux = navigator.platform.indexOf('Linux') == 0;
7
8 test(() => assert_selection(
9 '<div contenteditable>f |oo bar baz</div>',
10 selection => {
11 for (var i = 0; i < 7; ++i)
12 selection.modify('extend', 'forward', 'character');
13 },
14 '<div contenteditable>f ^oo bar | baz</div>'),
15 'extend forward character on characters');
16
17 test(() => assert_selection(
18 [
19 '<div contenteditable>',
20 '|a<img src="../../resources/abe.png">new',
21 '<br>nation <i> </i> <img src="../../resources/abe.png">',
22 '',
23 '',
24 'conceived',
25 '<br>nation<img src="../../resources/abe.png">',
26 '</div>',
27 ].join(' '),
28 selection => {
29 for (var i = 0; i < 33; ++i)
30 selection.modify('extend', 'forward', 'character');
31 },
32 [
33 '<div contenteditable>',
34 '^a<img src="../../resources/abe.png">new',
35 '<br>nation <i> </i> <img src="../../resources/abe.png">',
36 '',
37 '',
38 'conceived',
39 '<br>nation|<img src="../../resources/abe.png">',
40 '</div>',
41 ].join(' ')),
42 'extend forward character through image');
43
44 test(() => assert_selection(
45 [
46 '<div contenteditable>',
47 '<i>F |and seven</i> years <b> as </b>our fathers f upon this',
48 'continent, a new nation, conceived &nbsp;&nbsp; in Liberty, and d edicated to the',
49 'proposition that all ',
50 '<br>men are created equal.',
51 '</div>',
52 ].join(' '),
53 selection => {
54 // TODO(yosin): We should study why Linux behaves different to other
55 // platforms.
56 const loopCount = isLinux ? 159 : 157;
57 for (var i = 0; i < loopCount; ++i)
58 selection.modify('extend', 'forward', 'character');
59 },
60 [
61 '<div contenteditable>',
62 '<i>F ^and seven</i> years <b> as </b>our fathers f upon this',
63 'continent, a new nation, conceived \u{00A0}\u{00A0} in Liberty, a nd dedicated to the',
64 'proposition that all ',
65 '<br>men are created equal|.',
66 '</div>',
67 ].join(' ')),
68 'extend forward character through multiple spaces');
69
70 test(() => assert_selection(
71 [
72 '<div contenteditable>',
73 'a<img src="../../resources/abe.png">new',
74 '<br>nation <i> </i> <img src="../../resources/abe.png">',
75 '',
76 '',
77 'conceived',
78 '<br>nation|<img src="../../resources/abe.png">',
79 '</div>',
80 ].join(' '),
81 selection => {
82 for (var i = 0; i < 30; ++i)
83 selection.modify('extend', 'backward', 'character');
84 },
85 [
86 '<div contenteditable>',
87 'a<img src="../../resources/abe.png">n|ew',
88 '<br>nation <i> </i> <img src="../../resources/abe.png">',
89 '',
90 '',
91 'conceived',
92 '<br>nation^<img src="../../resources/abe.png">',
93 '</div>',
94 ].join(' ')),
95 'extend backward character through image');
96
97 test(() => assert_selection(
98 [
99 '<div contenteditable>',
100 '<i>F and seven</i> years <b> as </b>our fathers f upon this',
101 'continent, a new nation, conceived &nbsp;&nbsp; in Liberty, and d edicated to the',
102 'proposition that all ',
103 '<br>men are created equ|al.',
104 '</div>',
105 ].join(' '),
106 selection => {
107 // TODO(yosin): We should study why Linux behaves different to other
108 // platforms.
109 const loopCount = isLinux ? 159 : 157;
110 for (var i = 0; i < loopCount; ++i)
111 selection.modify('extend', 'backward', 'character');
112 },
113 [
114 '<div contenteditable>',
115 '<i>|F and seven</i> years <b> as </b>our fathers f upon this',
116 'continent, a new nation, conceived \u{00A0}\u{00A0} in Liberty, a nd dedicated to the',
117 'proposition that all ',
118 '<br>men are created equ^al.',
119 '</div>',
120 ].join(' ')),
121 'extend backward character through multiple spaces');
122
123 test(() => assert_selection(
124 '<div contenteditable><span> |foo</span> </div>',
125 selection => {
126 for (var i = 0; i < 4; ++i)
127 selection.modify('extend', 'forward', 'character');
128 },
129 '<div contenteditable><span> ^foo|</span> </div>'),
130 'extend forward character over element');
131 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698