1 description('Tests border-start and border-end');
3 function test(dir, css, queryProp)
5 var div = document.createElement('div');
6 div.setAttribute('style', css);
8 document.body.appendChild(div);
10 var result = getComputedStyle(div).getPropertyValue(queryProp);
11 document.body.removeChild(div);
15 function testSame(dir, prop, altProp, value)
17 shouldBeEqualToString('test("' + dir + '", "' + prop + ': ' + value + '", "' + altProp + '")', value);
18 shouldBeEqualToString('test("' + dir + '", "' + altProp + ': ' + value + '", "' + prop + '")', value);
21 function testWidth(dir, style)
23 var div = document.createElement('div');
24 div.setAttribute('style', 'width:100px;' + style);
26 document.body.appendChild(div);
28 var result = div.offsetWidth;
29 document.body.removeChild(div);
33 shouldBe('testWidth("ltr", "-webkit-border-start-width: 10px; -webkit-border-start-style: solid")', '110');
34 shouldBe('testWidth("ltr", "-webkit-border-end-width: 20px; -webkit-border-end-style: solid")', '120');
35 shouldBe('testWidth("rtl", "-webkit-border-start-width: 10px; -webkit-border-start-style: solid")', '110');
36 shouldBe('testWidth("rtl", "-webkit-border-end-width: 20px; -webkit-border-end-style: solid")', '120');
38 testSame('ltr', '-webkit-border-start-color', 'border-left-color', 'rgb(255, 0, 0)');
39 testSame('ltr', '-webkit-border-end-color', 'border-right-color', 'rgb(255, 0, 0)');
40 testSame('rtl', '-webkit-border-start-color', 'border-right-color', 'rgb(255, 0, 0)');
41 testSame('rtl', '-webkit-border-end-color', 'border-left-color', 'rgb(255, 0, 0)');
43 testSame('ltr', '-webkit-border-start-style', 'border-left-style', 'dotted');
44 testSame('ltr', '-webkit-border-end-style', 'border-right-style', 'dotted');
45 testSame('rtl', '-webkit-border-start-style', 'border-right-style', 'dotted');
46 testSame('rtl', '-webkit-border-end-style', 'border-left-style', 'dotted');
48 shouldBeEqualToString('test("ltr", "-webkit-border-start-width: 10px; -webkit-border-start-style: solid", "border-left-width")', '10px');
49 shouldBeEqualToString('test("ltr", "-webkit-border-end-width: 10px; -webkit-border-end-style: solid", "border-right-width")', '10px');
50 shouldBeEqualToString('test("rtl", "-webkit-border-start-width: 10px; -webkit-border-start-style: solid", "border-right-width")', '10px');
51 shouldBeEqualToString('test("rtl", "-webkit-border-end-width: 10px; -webkit-border-end-style: solid", "border-left-width")', '10px');
53 shouldBeEqualToString('test("ltr", "border-left: 10px solid", "-webkit-border-start-width")', '10px');
54 shouldBeEqualToString('test("ltr", "border-right: 10px solid", "-webkit-border-end-width")', '10px');
55 shouldBeEqualToString('test("rtl", "border-left: 10px solid", "-webkit-border-end-width")', '10px');
56 shouldBeEqualToString('test("rtl", "border-right: 10px solid", "-webkit-border-start-width")', '10px');
58 shouldBeEqualToString('test("ltr", "-webkit-border-start: 10px solid red", "border-left-color")', 'rgb(255, 0, 0)');
59 shouldBeEqualToString('test("ltr", "-webkit-border-start: 10px solid red", "border-left-style")', 'solid');
60 shouldBeEqualToString('test("ltr", "-webkit-border-start: 10px solid red", "border-left-width")', '10px');
62 shouldBeEqualToString('test("rtl", "-webkit-border-start: 10px solid red", "border-right-color")', 'rgb(255, 0, 0)');
63 shouldBeEqualToString('test("rtl", "-webkit-border-start: 10px solid red", "border-right-style")', 'solid');
64 shouldBeEqualToString('test("rtl", "-webkit-border-start: 10px solid red", "border-right-width")', '10px');
66 shouldBeEqualToString('test("ltr", "-webkit-border-end: 10px solid red", "border-right-color")', 'rgb(255, 0, 0)');
67 shouldBeEqualToString('test("ltr", "-webkit-border-end: 10px solid red", "border-right-style")', 'solid');
68 shouldBeEqualToString('test("ltr", "-webkit-border-end: 10px solid red", "border-right-width")', '10px');
70 shouldBeEqualToString('test("rtl", "-webkit-border-end: 10px solid red", "border-left-color")', 'rgb(255, 0, 0)');
71 shouldBeEqualToString('test("rtl", "-webkit-border-end: 10px solid red", "border-left-style")', 'solid');
72 shouldBeEqualToString('test("rtl", "-webkit-border-end: 10px solid red", "border-left-width")', '10px');