OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <title>Test that horizontal scrollbar should appear as the content width encroac
hes upon the vertical scrollbar and also test if WebKit can show the left side o
f the inner elements regardless of the position of its scrollbars. To test manua
lly, open this document and verify we can see "ABC" both in the LTR element and
in the RTL element.</title> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
5 </head> | 5 <script src="../../resources/testharnessreport.js"></script> |
6 <body dir="ltr"> | 6 <body dir="ltr"> |
7 <div dir="ltr" id="outer-ltr" style="width: 200px; height: 200px; overflow: auto
;"> | 7 <div dir="ltr" id="outer-ltr" style="width: 200px; height: 200px; overflow: auto
;"> |
8 <div id="inner-ltr" style="text-align: left; width: 195px; height: 300px;">ABC</
div> | 8 <div id="inner-ltr" style="text-align: left; width: 195px; height: 300px;">ABC</
div> |
9 </div> | 9 </div> |
10 <div dir="rtl" id="outer-rtl" style="width: 200px; height: 200px; overflow: auto
;"> | 10 <div dir="rtl" id="outer-rtl" style="width: 200px; height: 200px; overflow: auto
;"> |
11 <div id="inner-rtl" style="text-align: left; width: 195px; height: 300px;">ABC</
div> | 11 <div id="inner-rtl" style="text-align: left; width: 195px; height: 300px;">ABC</
div> |
12 </div> | 12 </div> |
13 <script type="text/javascript"> | 13 <script> |
14 description('Test that horizontal scrollbar should appear as the content width e
ncroaches upon the vertical scrollbar and also test if WebKit can show the left
side of the inner elements regardless of the position of its scrollbars. To test
manually, open this document and verify we can see "ABC" both in the LTR elemen
t and in the RTL element.'); | 14 test(function() { |
| 15 var outerLTR = document.getElementById("outer-ltr"); |
| 16 var innerLTR = document.getElementById("inner-ltr"); |
| 17 var outerRTL = document.getElementById("outer-rtl"); |
| 18 var innerRTL = document.getElementById("inner-rtl"); |
| 19 outerLTR.scrollLeft = 0; |
| 20 outerRTL.scrollLeft = 0; |
15 | 21 |
16 var outerLTR = document.getElementById('outer-ltr'); | 22 // Verify the widths of the outer RTL elements are the same as the widths of
the outer LTR elements. |
17 var innerLTR = document.getElementById('inner-ltr'); | 23 assert_equals(outerLTR.offsetWidth, outerRTL.offsetWidth); |
18 var outerRTL = document.getElementById('outer-rtl'); | 24 assert_equals(outerLTR.clientWidth, outerRTL.clientWidth); |
19 var innerRTL = document.getElementById('inner-rtl'); | 25 assert_equals(outerLTR.scrollWidth, outerRTL.scrollWidth); |
20 outerLTR.scrollLeft = 0; | |
21 outerRTL.scrollLeft = 0; | |
22 | 26 |
23 debug('Verify the widths of the outer RTL elements are the same as the widths of
the outer LTR elements.'); | 27 // Verify the widths of the inner RTL elements are the same as the widths of
the inner LTR elements. |
24 shouldBeTrue('outerLTR.offsetWidth == outerRTL.offsetWidth'); | 28 assert_equals(innerLTR.offsetWidth, innerRTL.offsetWidth); |
25 shouldBeTrue('outerLTR.clientWidth == outerRTL.clientWidth'); | 29 assert_equals(innerLTR.clientWidth, innerRTL.clientWidth); |
26 shouldBeTrue('outerLTR.scrollWidth == outerRTL.scrollWidth'); | 30 assert_equals(innerLTR.scrollWidth, innerRTL.scrollWidth); |
27 | 31 |
28 debug('Verify the widths of the inner RTL elements are the same as the widths of
the inner LTR elements.'); | 32 // Verify the width of the vertical scrollbar of the outer RTL element is th
e same as the one of the outer LTR element regardless of their scrollbar positio
ns. |
29 shouldBeTrue('innerLTR.offsetWidth == innerRTL.offsetWidth'); | 33 var scrollbarWidthLTR = outerLTR.offsetWidth - outerLTR.clientWidth; |
30 shouldBeTrue('innerLTR.clientWidth == innerRTL.clientWidth'); | 34 var scrollbarWidthRTL = outerRTL.offsetWidth - outerRTL.clientWidth; |
31 shouldBeTrue('innerLTR.scrollWidth == innerRTL.scrollWidth'); | 35 assert_equals(scrollbarWidthLTR, scrollbarWidthRTL); |
32 | 36 assert_equals(outerRTL.clientLeft, scrollbarWidthRTL); |
33 debug('Verify the width of the vertical scrollbar of the outer RTL element is th
e same as the one of the outer LTR element regardless of their scrollbar positio
ns.'); | 37 }); |
34 var scrollbarWidthLTR = outerLTR.offsetWidth - outerLTR.clientWidth; | |
35 var scrollbarWidthRTL = outerRTL.offsetWidth - outerRTL.clientWidth; | |
36 shouldBeTrue('scrollbarWidthLTR == scrollbarWidthRTL'); | |
37 shouldBeTrue('outerRTL.clientLeft == scrollbarWidthRTL'); | |
38 </script> | 38 </script> |
39 </body> | 39 </body> |
40 </html> | 40 </html> |
OLD | NEW |