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

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-28T10:36:48 Adopt to Linux behavior 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..88f5b6e55637e0028434c2c81677b9a7627af51d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/selection/modify_extend/extend_by_character.html
@@ -0,0 +1,131 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../assert_selection.js"></script>
+<script>
+const isLinux = navigator.platform.indexOf('Linux') == 0;
+
+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',
+ 'continent, a new nation, conceived &nbsp;&nbsp; in Liberty, and dedicated to the',
+ 'proposition that all ',
+ '<br>men are created equal.',
+ '</div>',
+ ].join(' '),
+ selection => {
+ // TODO(yosin): We should study why Linux behaves different to other
+ // platforms.
+ const loopCount = isLinux ? 159 : 157;
+ for (var i = 0; i < loopCount; ++i)
+ selection.modify('extend', 'forward', '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 equal|.',
+ '</div>',
+ ].join(' ')),
+ 'extend forward character through multiple spaces');
+
+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 < 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(
+ [
+ '<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 => {
+ // TODO(yosin): We should study why Linux behaves different to other
+ // platforms.
+ const loopCount = isLinux ? 159 : 157;
+ for (var i = 0; i < loopCount; ++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