5 <style type="text/css"> /* pertinent to test cases */
6 .quote:before { content: "\""; }
7 .quote:after { content: "\""; }
9 .bidi:before { content: "aפb"; }
10 .bidi:after { content: "aפb"; }
12 <script src="../../fast/js/resources/js-test-pre.js"></script>
16 <p>To manually test select text below by mouse and use right arrow key to navigate across the quotes. The caret should move to the right of quote.</p>
18 <div contenteditable="true" id="ltr">
20 <span class="quote">content</span>
24 <div contenteditable="true" id="rtl">
25 اردو وڑ
26 <span class="quote">پروسیسرس پر</span>
27 تبصر
30 <div contenteditable="true" id="ltr-bidi">
32 <span class="bidi">content</span>
36 <div contenteditable="true" id="rtl-bidi">
37 اردو وڑ
38 <span class="bidi">پروسیسرس پر</span>
39 تبصر
41 <div id="console"></div>
44 var edit = document.getElementById('ltr');
46 window.getSelection().setPosition(edit, 1);
47 window.getSelection().modify('move', 'right', 'character');
48 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 1);
49 window.getSelection().modify('move', 'left', 'character');
50 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 16);
52 window.getSelection().setPosition(edit, 2);
53 window.getSelection().modify('move', 'right', 'character');
54 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 1);
55 window.getSelection().modify('move', 'left', 'character');
56 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 7);
58 var edit = document.getElementById('rtl');
60 window.getSelection().setPosition(edit, 1);
61 window.getSelection().modify('move', 'left', 'character');
62 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 1);
63 window.getSelection().modify('move', 'right', 'character');
64 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 9);
65 window.getSelection().modify('move', 'right', 'character');
66 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 8);
67 window.getSelection().modify('move', 'left', 'character');
68 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 9);
70 window.getSelection().setPosition(edit, 2);
71 window.getSelection().modify('move', 'left', 'character');
72 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 1);
73 window.getSelection().modify('move', 'right', 'character');
74 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 11);
75 window.getSelection().modify('move', 'right', 'character');
76 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 10);
77 window.getSelection().modify('move', 'left', 'character');
78 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 11);
80 var edit = document.getElementById('ltr-bidi');
82 window.getSelection().setPosition(edit, 1);
83 window.getSelection().modify('move', 'right', 'character');
84 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 1);
85 window.getSelection().modify('move', 'left', 'character');
86 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 16);
88 window.getSelection().setPosition(edit, 2);
89 window.getSelection().modify('move', 'right', 'character');
90 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 1);
91 window.getSelection().modify('move', 'left', 'character');
92 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 7);
94 var edit = document.getElementById('rtl-bidi');
96 window.getSelection().setPosition(edit, 1);
97 window.getSelection().modify('move', 'right', 'character');
98 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 10);
99 window.getSelection().modify('move', 'left', 'character');
100 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 9);
101 window.getSelection().modify('move', 'left', 'character');
102 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 8);
103 window.getSelection().modify('move', 'right', 'character');
104 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 9);
106 window.getSelection().setPosition(edit, 2);
107 window.getSelection().modify('move', 'right', 'character');
108 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 1);
109 window.getSelection().modify('move', 'left', 'character');
110 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 11);
111 window.getSelection().modify('move', 'left', 'character');
112 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 1);
113 window.getSelection().modify('move', 'right', 'character');
114 shouldEvaluateTo(window.getSelection().anchorOffset.toString(), 11);
118 <script src="../../fast/js/resources/js-test-post.js"></script>