| 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 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 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>
|
|
|