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

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-27T15:09:26 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 test(() => assert_selection(
7 '<div contenteditable>f |oo bar baz</div>',
8 selection => {
9 for (var i = 0; i < 7; ++i)
10 selection.modify('extend', 'forward', 'character');
11 },
12 '<div contenteditable>f ^oo bar | baz</div>'),
13 'extend forward character on characters');
14
15 test(() => assert_selection(
16 [
17 '<div contenteditable>',
18 '|a<img src="../../resources/abe.png">new',
19 '<br>nation <i> </i> <img src="../../resources/abe.png">',
20 '',
21 '',
22 'conceived',
23 '<br>nation<img src="../../resources/abe.png">',
24 '</div>',
25 ].join(' '),
26 selection => {
27 for (var i = 0; i < 33; ++i)
28 selection.modify('extend', 'forward', 'character');
29 },
30 [
31 '<div contenteditable>',
32 '^a<img src="../../resources/abe.png">new',
33 '<br>nation <i> </i> <img src="../../resources/abe.png">',
34 '',
35 '',
36 'conceived',
37 '<br>nation|<img src="../../resources/abe.png">',
38 '</div>',
39 ].join(' ')),
40 'extend forward character through image');
41
42 test(() => assert_selection(
43 [
44 '<div contenteditable>',
45 '<i>|F and seven</i> years <b> as </b>our fathers f upon this',
Xiaocheng 2016/07/27 08:30:11 The initial caret should be before "and".
yosin_UTC9 2016/07/27 09:08:18 Done
46 'continent, a new nation, conceived &nbsp;&nbsp; in Liberty, and d edicated to the',
47 'proposition that all ',
48 '<br>men are created equal.',
49 '</div>',
50 ].join(' '),
51 selection => {
52 for (var i = 0; i < 157; ++i)
53 selection.modify('extend', 'forward', 'character');
54 },
55 [
56 '<div contenteditable>',
57 '<i>^F and seven</i> years <b> as </b>our fathers f upon this',
Xiaocheng 2016/07/27 08:30:11 The final selection should start before "and".
yosin_UTC9 2016/07/27 09:08:18 Done.
58 'continent, a new nation, conceived \u{00A0}\u{00A0} in Liberty, a nd dedicated to the',
59 'proposition that all ',
60 '<br>men are created equ|al.',
Xiaocheng 2016/07/27 08:30:11 The final selection should end before the last "."
yosin_UTC9 2016/07/27 09:08:18 Done.
61 '</div>',
62 ].join(' ')),
63 'extend forward character through multiple spaces');
64
65 test(() => assert_selection(
Xiaocheng 2016/07/27 08:30:11 The initial caret should be before "a", and the te
yosin_UTC9 2016/07/27 09:08:18 Oops. Done.
66 [
67 '<div contenteditable>',
68 'a<img src="../../resources/abe.png">new',
69 '<br>nation <i> </i> <img src="../../resources/abe.png">',
70 '',
71 '',
72 'conceived',
73 '<br>nation|<img src="../../resources/abe.png">',
74 '</div>',
75 ].join(' '),
76 selection => {
77 for (var i = 0; i < 30; ++i)
78 selection.modify('extend', 'backward', 'character');
79 },
80 [
81 '<div contenteditable>',
82 'a<img src="../../resources/abe.png">n|ew',
83 '<br>nation <i> </i> <img src="../../resources/abe.png">',
84 '',
85 '',
86 'conceived',
87 '<br>nation^<img src="../../resources/abe.png">',
88 '</div>',
89 ].join(' ')),
90 'extend backward character through image');
91
92 test(() => assert_selection(
Xiaocheng 2016/07/27 08:30:11 The initial caret should be before "F", and the te
yosin_UTC9 2016/07/27 09:08:18 I omits 33 times of move-forward-by-character, sin
Xiaocheng 2016/07/27 10:21:06 OK, that's acceptable.
93 [
94 '<div contenteditable>',
95 '<i>F and seven</i> years <b> as </b>our fathers f upon this',
96 'continent, a new nation, conceived &nbsp;&nbsp; in Liberty, and d edicated to the',
97 'proposition that all ',
98 '<br>men are created equ|al.',
99 '</div>',
100 ].join(' '),
101 selection => {
102 for (var i = 0; i < 157; ++i)
103 selection.modify('extend', 'backward', 'character');
104 },
105 [
106 '<div contenteditable>',
107 '<i>|F and seven</i> years <b> as </b>our fathers f upon this',
108 'continent, a new nation, conceived \u{00A0}\u{00A0} in Liberty, a nd dedicated to the',
109 'proposition that all ',
110 '<br>men are created equ^al.',
111 '</div>',
112 ].join(' ')),
113 'extend backward character through multiple spaces');
114
115 test(() => assert_selection(
116 '<div contenteditable><span> |foo</span> </div>',
117 selection => {
118 for (var i = 0; i < 4; ++i)
119 selection.modify('extend', 'forward', 'character');
120 },
121 '<div contenteditable><span> ^foo|</span> </div>'),
122 'extend forward character over element');
123 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698