Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / 51344.html
blob696a3e720259fe0960305f6bc7caa918153504a5
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title>Test for bug 51344: move left/right by character should not hang.</title>
6 </head>
7 <body>
8 <p>Test for bug 51344: move left/right by character should not hang.
9 <div id="test" dir="ltr" contenteditable>١١123مارس</div>
10 <div id="test_rtl" dir="rtl" contenteditable>&#1494;&#1495; &#x202a;&#1491;&#1492;&#x202a;car &#1493;&#x202c;&#x202c; </div>
12 <ul id="console"></ul>
14 <script>
15 if (window.testRunner)
16 testRunner.dumpAsText();
18 function log(str) {
19 var li = document.createElement("li");
20 li.appendChild(document.createTextNode(str));
21 var console = document.getElementById("console");
22 console.appendChild(li);
25 function assert(bool) {
26 if (!bool)
27 log("Failure");
28 else
29 log("Success");
32 var test = document.getElementById('test');
33 var selection = window.getSelection();
34 selection.collapse(test.firstChild, 6);
35 selection.modify('move', 'right', 'character');
36 var offset = selection.anchorOffset;
37 assert(offset == 1);
38 test.style.display = "none";
40 test = document.getElementById('test_rtl');
41 selection = window.getSelection();
42 selection.collapse(test.firstChild, 3);
43 selection.modify('move', 'left', 'character');
44 offset = selection.anchorOffset;
45 assert(offset == 4);
46 test.style.display = "none";
48 </script>
49 </body>
50 </html>