1 description('Tests margin-start and margin-end');
3 function test(dir, prop, value, queryProp)
5 var outerDiv = document.createElement('div');
6 outerDiv.style.width = '100px';
8 document.body.appendChild(outerDiv);
10 var div = document.createElement('div');
11 div.textContent = '\u00a0'; //
12 div.setAttribute('style', prop + ':' + value);
13 outerDiv.appendChild(div);
15 var result = getComputedStyle(div).getPropertyValue(queryProp);
16 document.body.removeChild(outerDiv);
20 shouldBeEqualToString('test("ltr", "-webkit-margin-start", "10px", "width")', '90px');
21 shouldBeEqualToString('test("ltr", "-webkit-margin-end", "20px", "width")', '80px');
22 shouldBeEqualToString('test("ltr", "-webkit-margin-start", "10px", "margin-left")', '10px');
23 shouldBeEqualToString('test("ltr", "-webkit-margin-end", "20px", "margin-right")', '20px');
24 shouldBeEqualToString('test("ltr", "margin-left", "10px", "-webkit-margin-start")', '10px');
25 shouldBeEqualToString('test("ltr", "margin-right", "20px", "-webkit-margin-end")', '20px');
27 shouldBeEqualToString('test("rtl", "-webkit-margin-start", "10px", "width")', '90px');
28 shouldBeEqualToString('test("rtl", "-webkit-margin-end", "20px", "width")', '80px');
29 shouldBeEqualToString('test("rtl", "-webkit-margin-start", "10px", "margin-right")', '10px');
30 shouldBeEqualToString('test("rtl", "-webkit-margin-end", "20px", "margin-left")', '20px');
31 shouldBeEqualToString('test("rtl", "margin-right", "10px", "-webkit-margin-start")', '10px');
32 shouldBeEqualToString('test("rtl", "margin-left", "20px", "-webkit-margin-end")', '20px');