OLD | NEW |
1 description('Tests to ensure MakeTextWritingDirection* modifies the direction of
text and embed texts properly.'); | 1 description('Tests to ensure MakeTextWritingDirection* modifies the direction of
text and embed texts properly.'); |
2 | 2 |
3 if (window.internals) | 3 if (window.internals) |
4 internals.settings.setEditingBehavior('mac'); | 4 internals.settings.setEditingBehavior('mac'); |
5 if (!window.testRunner) | 5 if (!window.testRunner) |
6 testFailed('This test requires testRunner'); | 6 testFailed('This test requires testRunner'); |
7 | 7 |
8 var testContainer = document.createElement("div"); | 8 var testContainer = document.createElement("div"); |
9 testContainer.contentEditable = true; | 9 testContainer.contentEditable = true; |
10 document.body.appendChild(testContainer); | 10 document.body.appendChild(testContainer); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 function selectThirdWord(container) { | 61 function selectThirdWord(container) { |
62 document.getSelection().setBaseAndExtent(container, 0, container, 0); | 62 document.getSelection().setBaseAndExtent(container, 0, container, 0); |
63 document.getSelection().modify('move', 'forward', 'word'); | 63 document.getSelection().modify('move', 'forward', 'word'); |
64 document.getSelection().modify('move', 'forward', 'word'); | 64 document.getSelection().modify('move', 'forward', 'word'); |
65 document.getSelection().modify('extend', 'forward', 'word'); | 65 document.getSelection().modify('extend', 'forward', 'word'); |
66 return 'third word'; | 66 return 'third word'; |
67 } | 67 } |
68 | 68 |
69 // left to right language | 69 // left to right language |
70 modifyWritingDirection('hello world', selectFirstWord, 'Natural', 'hello world')
; | 70 modifyWritingDirection('hello world', selectFirstWord, 'Natural', 'hello world')
; |
71 modifyWritingDirection('hello world', selectFirstWord, 'LeftToRight', '<span sty
le="unicode-bidi: embed;">hello</span> world'); | 71 modifyWritingDirection('hello world', selectFirstWord, 'LeftToRight', '<span sty
le="unicode-bidi: isolate;">hello</span> world'); |
72 modifyWritingDirection('hello world', selectFirstWord, 'RightToLeft', '<span sty
le="unicode-bidi: embed; direction: rtl;">hello</span> world'); | 72 modifyWritingDirection('hello world', selectFirstWord, 'RightToLeft', '<span sty
le="unicode-bidi: isolate; direction: rtl;">hello</span> world'); |
73 modifyWritingDirection('<b>hello world</b> webkit', selectSecondAndThirdWords, '
Natural', '<b>hello world</b> webkit'); | 73 modifyWritingDirection('<b>hello world</b> webkit', selectSecondAndThirdWords, '
Natural', '<b>hello world</b> webkit'); |
74 modifyWritingDirection('<b>hello world</b> webkit', selectSecondAndThirdWords, '
LeftToRight', '<b>hello<span style="unicode-bidi: embed;"> world</span></b><span
style="unicode-bidi: embed;"> webkit</span>'); | 74 modifyWritingDirection('<b>hello world</b> webkit', selectSecondAndThirdWords, '
LeftToRight', '<b>hello<span style="unicode-bidi: isolate;"> world</span></b><sp
an style="unicode-bidi: isolate;"> webkit</span>'); |
75 modifyWritingDirection('<b>hello world</b> webkit', selectSecondAndThirdWords, '
RightToLeft', '<b>hello<span style="unicode-bidi: embed; direction: rtl;"> world
</span></b><span style="unicode-bidi: embed; direction: rtl;"> webkit</span>'); | 75 modifyWritingDirection('<b>hello world</b> webkit', selectSecondAndThirdWords, '
RightToLeft', '<b>hello<span style="unicode-bidi: isolate; direction: rtl;"> wor
ld</span></b><span style="unicode-bidi: isolate; direction: rtl;"> webkit</span>
'); |
76 modifyWritingDirection('<span dir="rtl">hello <span dir="ltr">world webkit rocks
</span></span>', selectThirdWord, 'Natural', | 76 modifyWritingDirection('<span dir="rtl">hello <span dir="ltr">world webkit rocks
</span></span>', selectThirdWord, 'Natural', |
77 '<span dir="rtl">hello <span dir="ltr">world</span></span
> webkit<span dir="rtl"><span dir="ltr"> rocks</span></span>'); | 77 '<span dir="rtl">hello <span dir="ltr">world</span></span
> webkit<span dir="rtl"><span dir="ltr"> rocks</span></span>'); |
78 modifyWritingDirection('<span dir="rtl">hello <span dir="ltr">world webkit rocks
</span></span>', selectThirdWord, 'LeftToRight', | 78 modifyWritingDirection('<span dir="rtl">hello <span dir="ltr">world webkit rocks
</span></span>', selectThirdWord, 'LeftToRight', |
79 '<span dir="rtl">hello <span dir="ltr">world</span></span
><span style="unicode-bidi: embed;"> webkit</span><span dir="rtl"><span dir="ltr
"> rocks</span></span>'); | 79 '<span dir="rtl">hello <span dir="ltr">world</span></span
><span style="unicode-bidi: isolate;"> webkit</span><span dir="rtl"><span dir="l
tr"> rocks</span></span>'); |
80 modifyWritingDirection('<span dir="rtl">hello <span dir="ltr">world webkit rocks
</span></span>', selectThirdWord, 'RightToLeft', | 80 modifyWritingDirection('<span dir="rtl">hello <span dir="ltr">world webkit rocks
</span></span>', selectThirdWord, 'RightToLeft', |
81 '<span dir="rtl">hello <span dir="ltr">world</span> webki
t<span dir="ltr"> rocks</span></span>'); | 81 '<span dir="rtl">hello <span dir="ltr">world</span> webki
t<span dir="ltr"> rocks</span></span>'); |
82 | 82 |
83 // right to left language | 83 // right to left language |
84 modifyWritingDirection('هنا يكتب النص العربي', selectFirstWord, 'Natural', 'هنا
يكتب النص العربي'); | 84 modifyWritingDirection('هنا يكتب النص العربي', selectFirstWord, 'Natural', 'هنا
يكتب النص العربي'); |
85 modifyWritingDirection('هنا يكتب النص العربي', selectFirstWord, 'LeftToRight', '
<span style="unicode-bidi: embed;">هنا</span> يكتب النص العربي'); | 85 modifyWritingDirection('هنا يكتب النص العربي', selectFirstWord, 'LeftToRight', '
<span style="unicode-bidi: isolate;">هنا</span> يكتب النص العربي'); |
86 modifyWritingDirection('هنا يكتب النص العربي', selectFirstWord, 'RightToLeft', '
<span style="unicode-bidi: embed; direction: rtl;">هنا</span> يكتب النص العربي')
; | 86 modifyWritingDirection('هنا يكتب النص العربي', selectFirstWord, 'RightToLeft', '
<span style="unicode-bidi: isolate; direction: rtl;">هنا</span> يكتب النص العربي
'); |
87 | 87 |
88 modifyWritingDirection('<b>هنا يكتب</b> النص العربي', selectSecondAndThirdWords,
'Natural', '<b>هنا يكتب</b> النص العربي'); | 88 modifyWritingDirection('<b>هنا يكتب</b> النص العربي', selectSecondAndThirdWords,
'Natural', '<b>هنا يكتب</b> النص العربي'); |
89 modifyWritingDirection('<b>هنا يكتب</b> النص العربي', selectSecondAndThirdWords,
'LeftToRight', '<b>هنا<span style="unicode-bidi: embed;"> يكتب</span></b><span
style="unicode-bidi: embed;"> النص</span> العربي'); | 89 modifyWritingDirection('<b>هنا يكتب</b> النص العربي', selectSecondAndThirdWords,
'LeftToRight', '<b>هنا<span style="unicode-bidi: isolate;"> يكتب</span></b><spa
n style="unicode-bidi: isolate;"> النص</span> العربي'); |
90 modifyWritingDirection('<b>هنا يكتب</b> النص العربي', selectSecondAndThirdWords,
'RightToLeft', '<b>هنا<span style="unicode-bidi: embed; direction: rtl;"> يكتب<
/span></b><span style="unicode-bidi: embed; direction: rtl;"> النص</span> العربي
'); | 90 modifyWritingDirection('<b>هنا يكتب</b> النص العربي', selectSecondAndThirdWords,
'RightToLeft', '<b>هنا<span style="unicode-bidi: isolate; direction: rtl;"> يكت
ب</span></b><span style="unicode-bidi: isolate; direction: rtl;"> النص</span> ال
عربي'); |
91 | 91 |
92 modifyWritingDirection('<div dir="rtl">هنا يكتب النص العربي</div>', selectFirstW
ord, 'Natural', '<div dir="rtl">هنا يكتب النص العربي</div>'); | 92 modifyWritingDirection('<div dir="rtl">هنا يكتب النص العربي</div>', selectFirstW
ord, 'Natural', '<div dir="rtl">هنا يكتب النص العربي</div>'); |
93 modifyWritingDirection('<div dir="rtl">هنا يكتب النص العربي</div>', selectFirstW
ord, 'LeftToRight', '<div dir="rtl"><span style="unicode-bidi: embed; direction:
ltr;">هنا</span> يكتب النص العربي</div>'); | 93 modifyWritingDirection('<div dir="rtl">هنا يكتب النص العربي</div>', selectFirstW
ord, 'LeftToRight', '<div dir="rtl"><span style="unicode-bidi: isolate; directio
n: ltr;">هنا</span> يكتب النص العربي</div>'); |
94 modifyWritingDirection('<div dir="rtl">هنا يكتب النص العربي</div>', selectFirstW
ord, 'RightToLeft', '<div dir="rtl"><span style="unicode-bidi: embed;">هنا</span
> يكتب النص العربي</div>'); | 94 modifyWritingDirection('<div dir="rtl">هنا يكتب النص العربي</div>', selectFirstW
ord, 'RightToLeft', '<div dir="rtl"><span style="unicode-bidi: isolate;">هنا</sp
an> يكتب النص العربي</div>'); |
95 | 95 |
96 modifyWritingDirection('<div dir="rtl"><b>هنا يكتب</b> النص العربي</div>', selec
tSecondAndThirdWords, 'Natural', '<div dir="rtl"><b>هنا يكتب</b> النص العربي</di
v>'); | 96 modifyWritingDirection('<div dir="rtl"><b>هنا يكتب</b> النص العربي</div>', selec
tSecondAndThirdWords, 'Natural', '<div dir="rtl"><b>هنا يكتب</b> النص العربي</di
v>'); |
97 modifyWritingDirection('<div dir="rtl"><b>هنا يكتب</b> النص العربي</div>', selec
tSecondAndThirdWords, 'LeftToRight', '<div dir="rtl"><b>هنا<span style="unicode-
bidi: embed; direction: ltr;"> يكتب</span></b><span style="unicode-bidi: embed;
direction: ltr;"> النص</span> العربي</div>'); | 97 modifyWritingDirection('<div dir="rtl"><b>هنا يكتب</b> النص العربي</div>', selec
tSecondAndThirdWords, 'LeftToRight', '<div dir="rtl"><b>هنا<span style="unicode-
bidi: isolate; direction: ltr;"> يكتب</span></b><span style="unicode-bidi: isola
te; direction: ltr;"> النص</span> العربي</div>'); |
98 modifyWritingDirection('<div dir="rtl"><b>هنا يكتب</b> النص العربي</div>', selec
tSecondAndThirdWords, 'RightToLeft', '<div dir="rtl"><b>هنا<span style="unicode-
bidi: embed;"> يكتب</span></b><span style="unicode-bidi: embed;"> النص</span> ال
عربي</div>'); | 98 modifyWritingDirection('<div dir="rtl"><b>هنا يكتب</b> النص العربي</div>', selec
tSecondAndThirdWords, 'RightToLeft', '<div dir="rtl"><b>هنا<span style="unicode-
bidi: isolate;"> يكتب</span></b><span style="unicode-bidi: isolate;"> النص</span
> العربي</div>'); |
99 modifyWritingDirection('<div dir="rtl">هنا <span dir="ltr">يكتب النص العربي</spa
n></div>', selectThirdWord, 'Natural', | 99 modifyWritingDirection('<div dir="rtl">هنا <span dir="ltr">يكتب النص العربي</spa
n></div>', selectThirdWord, 'Natural', |
100 '<div dir="rtl">هنا <span dir="ltr">يكتب</span> النص<span
dir="ltr"> العربي</span></div>'); | 100 '<div dir="rtl">هنا <span dir="ltr">يكتب</span> النص<span
dir="ltr"> العربي</span></div>'); |
101 modifyWritingDirection('<div dir="rtl">هنا <span dir="ltr">يكتب النص العربي</spa
n></div>', selectThirdWord, 'LeftToRight', | 101 modifyWritingDirection('<div dir="rtl">هنا <span dir="ltr">يكتب النص العربي</spa
n></div>', selectThirdWord, 'LeftToRight', |
102 '<div dir="rtl"><span style="unicode-bidi: embed; directi
on: ltr;">هنا يكتب النص العربي</span></div>'); | 102 '<div dir="rtl"><span style="unicode-bidi: isolate; direc
tion: ltr;">هنا يكتب النص العربي</span></div>'); |
103 modifyWritingDirection('<div dir="rtl">هنا <span dir="ltr">يكتب النص العربي</spa
n></div>', selectThirdWord, 'RightToLeft', | 103 modifyWritingDirection('<div dir="rtl">هنا <span dir="ltr">يكتب النص العربي</spa
n></div>', selectThirdWord, 'RightToLeft', |
104 '<div dir="rtl">هنا <span dir="ltr">يكتب</span><span styl
e="unicode-bidi: embed;"> النص</span><span dir="ltr"> العربي</span></div>'); | 104 '<div dir="rtl">هنا <span dir="ltr">يكتب</span><span styl
e="unicode-bidi: isolate;"> النص</span><span dir="ltr"> العربي</span></div>'); |
105 | 105 |
106 // bidirectional langauge | 106 // bidirectional langauge |
107 modifyWritingDirection('写中文', selectFirstWord, 'Natural', '写中文'); | 107 modifyWritingDirection('写中文', selectFirstWord, 'Natural', '写中文'); |
108 modifyWritingDirection('写中文', selectFirstWord, 'LeftToRight', '<span style="unic
ode-bidi: embed;">写</span>中文'); | 108 modifyWritingDirection('写中文', selectFirstWord, 'LeftToRight', '<span style="unic
ode-bidi: isolate;">写</span>中文'); |
109 modifyWritingDirection('写中文', selectFirstWord, 'RightToLeft', '<span style="unic
ode-bidi: embed; direction: rtl;">写</span>中文'); | 109 modifyWritingDirection('写中文', selectFirstWord, 'RightToLeft', '<span style="unic
ode-bidi: isolate; direction: rtl;">写</span>中文'); |
110 | 110 |
111 modifyWritingDirection('<div dir="rtl">写中文</div>', selectFirstWord, 'Natural', '
<div dir="rtl">写中文</div>'); | 111 modifyWritingDirection('<div dir="rtl">写中文</div>', selectFirstWord, 'Natural', '
<div dir="rtl">写中文</div>'); |
112 modifyWritingDirection('<div dir="rtl">写中文</div>', selectFirstWord, 'LeftToRight
', '<div dir="rtl"><span style="unicode-bidi: embed; direction: ltr;">写</span>中文
</div>'); | 112 modifyWritingDirection('<div dir="rtl">写中文</div>', selectFirstWord, 'LeftToRight
', '<div dir="rtl"><span style="unicode-bidi: isolate; direction: ltr;">写</span>
中文</div>'); |
113 modifyWritingDirection('<div dir="rtl">写中文</div>', selectFirstWord, 'RightToLeft
', '<div dir="rtl"><span style="unicode-bidi: embed;">写</span>中文</div>'); | 113 modifyWritingDirection('<div dir="rtl">写中文</div>', selectFirstWord, 'RightToLeft
', '<div dir="rtl"><span style="unicode-bidi: isolate;">写</span>中文</div>'); |
114 | 114 |
115 document.body.removeChild(testContainer); | 115 document.body.removeChild(testContainer); |
116 | 116 |
117 var successfullyParsed = true; | 117 var successfullyParsed = true; |
OLD | NEW |