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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/editing/selection/modify_extend/extend_by_character.html
diff --git a/third_party/WebKit/LayoutTests/editing/selection/modify_extend/extend_by_character.html b/third_party/WebKit/LayoutTests/editing/selection/modify_extend/extend_by_character.html
new file mode 100644
index 0000000000000000000000000000000000000000..9762dba097fe2e2f99a8152a6df954a37eee3d2d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/selection/modify_extend/extend_by_character.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../assert_selection.js"></script>
+<script>
+test(() => assert_selection(
+ '<div contenteditable>f |oo bar baz</div>',
+ selection => {
+ for (var i = 0; i < 7; ++i)
+ selection.modify('extend', 'forward', 'character');
+ },
+ '<div contenteditable>f ^oo bar | baz</div>'),
+ 'extend forward character on characters');
+
+test(() => assert_selection(
+ [
+ '<div contenteditable>',
+ '|a<img src="../../resources/abe.png">new',
+ '<br>nation <i> </i> <img src="../../resources/abe.png">',
+ '',
+ '',
+ 'conceived',
+ '<br>nation<img src="../../resources/abe.png">',
+ '</div>',
+ ].join(' '),
+ selection => {
+ for (var i = 0; i < 33; ++i)
+ selection.modify('extend', 'forward', 'character');
+ },
+ [
+ '<div contenteditable>',
+ '^a<img src="../../resources/abe.png">new',
+ '<br>nation <i> </i> <img src="../../resources/abe.png">',
+ '',
+ '',
+ 'conceived',
+ '<br>nation|<img src="../../resources/abe.png">',
+ '</div>',
+ ].join(' ')),
+ 'extend forward character through image');
+
+test(() => assert_selection(
+ [
+ '<div contenteditable>',
+ '<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
+ 'continent, a new nation, conceived &nbsp;&nbsp; in Liberty, and dedicated to the',
+ 'proposition that all ',
+ '<br>men are created equal.',
+ '</div>',
+ ].join(' '),
+ selection => {
+ for (var i = 0; i < 157; ++i)
+ selection.modify('extend', 'forward', 'character');
+ },
+ [
+ '<div contenteditable>',
+ '<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.
+ 'continent, a new nation, conceived \u{00A0}\u{00A0} in Liberty, and dedicated to the',
+ 'proposition that all ',
+ '<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.
+ '</div>',
+ ].join(' ')),
+ 'extend forward character through multiple spaces');
+
+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.
+ [
+ '<div contenteditable>',
+ 'a<img src="../../resources/abe.png">new',
+ '<br>nation <i> </i> <img src="../../resources/abe.png">',
+ '',
+ '',
+ 'conceived',
+ '<br>nation|<img src="../../resources/abe.png">',
+ '</div>',
+ ].join(' '),
+ selection => {
+ for (var i = 0; i < 30; ++i)
+ selection.modify('extend', 'backward', 'character');
+ },
+ [
+ '<div contenteditable>',
+ 'a<img src="../../resources/abe.png">n|ew',
+ '<br>nation <i> </i> <img src="../../resources/abe.png">',
+ '',
+ '',
+ 'conceived',
+ '<br>nation^<img src="../../resources/abe.png">',
+ '</div>',
+ ].join(' ')),
+ 'extend backward character through image');
+
+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.
+ [
+ '<div contenteditable>',
+ '<i>F and seven</i> years <b> as </b>our fathers f upon this',
+ 'continent, a new nation, conceived &nbsp;&nbsp; in Liberty, and dedicated to the',
+ 'proposition that all ',
+ '<br>men are created equ|al.',
+ '</div>',
+ ].join(' '),
+ selection => {
+ for (var i = 0; i < 157; ++i)
+ selection.modify('extend', 'backward', 'character');
+ },
+ [
+ '<div contenteditable>',
+ '<i>|F and seven</i> years <b> as </b>our fathers f upon this',
+ 'continent, a new nation, conceived \u{00A0}\u{00A0} in Liberty, and dedicated to the',
+ 'proposition that all ',
+ '<br>men are created equ^al.',
+ '</div>',
+ ].join(' ')),
+ 'extend backward character through multiple spaces');
+
+test(() => assert_selection(
+ '<div contenteditable><span> |foo</span> </div>',
+ selection => {
+ for (var i = 0; i < 4; ++i)
+ selection.modify('extend', 'forward', 'character');
+ },
+ '<div contenteditable><span> ^foo|</span> </div>'),
+ 'extend forward character over element');
+</script>

Powered by Google App Engine
This is Rietveld 408576698