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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/modify_move/move-by-character-brute-force.html

Issue 1809963002: [Editing][CodeHealth] Use w3c testharness in editing/seletion/move-by-* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 9 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 <meta charset="UTF-8">
5 <div id="sample"></div>
6 <div id="log"></div>
7 <script>
8 test(function(){
9 function hasSimpleCaretMovement(charCode) {
10 var testString = "aaaaa" + String.fromCharCode(charCode) + "bbbb";
11 sample.textContent = testString;
12 var selection = window.getSelection();
13 selection.collapse(sample, 0);
14 for (var i = 0; i < testString.length; ++i) {
15 selection.modify("move", "forward", "character");
16 if (selection.baseOffset != i + 1)
17 return false;
18 }
19 return true;
20 }
21
22 function toHex(i) {
23 var hex = i.toString(16);
24 while (hex.length < 4)
25 hex = "0" + hex;
26 return hex;
27 }
28
29
30 assert_true(hasSimpleCaretMovement(0x0041));
31
32 assert_false(hasSimpleCaretMovement(0x0300));
33
34 for (var i = 1; i < 1024; ++i) {
35 if (i >= 0x0300 && i <= 0x036F)
36 assert_false(hasSimpleCaretMovement(i));
37 else
38 assert_true(hasSimpleCaretMovement(i));
39 }
40 }, "This test checks that we have simple caret motion up to a certain limit");
41 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698