OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | 3 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <p>This test checks how character breaks are computed for regional indicator cha
racters.</p> | 7 <p>This test checks how character breaks are computed for regional indicator cha
racters.</p> |
8 <div contenteditable id="test">🇯🇵🇯🇵🇯🇵</div> <!-- (j)(p)(j)(p)(j)(p) --> | 8 <div contenteditable id="test">🇯🇵🇯🇵🇯🇵</div> <!-- (j)(p)(j)(p)(j)(p) --> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 <script> | 10 <script> |
11 | 11 |
12 var div = document.getElementById("test"); | 12 var div = document.getElementById("test"); |
13 var afterLastIndicator = document.createRange(); | 13 var afterLastIndicator = document.createRange(); |
14 | 14 |
15 afterLastIndicator.setStart(div.firstChild, 12); | 15 afterLastIndicator.setStart(div.firstChild, 12); |
16 document.getSelection().addRange(afterLastIndicator); | 16 document.getSelection().addRange(afterLastIndicator); |
17 document.getSelection().modify("extend", "left", "character"); | 17 document.getSelection().modify("extend", "left", "character"); |
18 shouldBe("document.getSelection().toString()", "'🇯🇵'"); | 18 shouldBe("document.getSelection().toString()", "'🇯🇵'"); |
19 | 19 |
20 div.innerText = "🇯🇵🇯🇵"; | 20 div.innerText = "🇯🇵🇯🇵"; |
21 afterLastIndicator.setStart(div.firstChild, 8); | 21 afterLastIndicator.setStart(div.firstChild, 8); |
22 getSelection().removeAllRanges(); | 22 getSelection().removeAllRanges(); |
23 document.getSelection().addRange(afterLastIndicator); | 23 document.getSelection().addRange(afterLastIndicator); |
24 document.getSelection().modify("extend", "left", "character"); | 24 document.getSelection().modify("extend", "left", "character"); |
25 shouldBe("document.getSelection().toString()", "'🇯🇵'"); | 25 shouldBe("document.getSelection().toString()", "'🇯🇵'"); |
26 | 26 |
27 | 27 |
28 </script> | 28 </script> |
29 </body> | 29 </body> |
30 </html> | 30 </html> |
OLD | NEW |