Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <style> | |
| 4 * { font-size: 16px; } | |
| 5 svg, rect, div { font-family: 'Ahem'; } | |
| 6 </style> | |
| 7 <html> | |
| 8 <svg id="svg" width="0" height="0"></svg> | |
| 9 <script src="../resources/js-test.js"></script> | |
| 10 <script> | |
| 11 description("Test ex unit with Ahem font"); | |
| 12 | |
| 13 function computedStyleDiv(property, value) { | |
| 14 var div = document.createElement("div"); | |
| 15 document.body.appendChild(div); | |
| 16 div.style[property] = value; | |
| 17 var computedValue = getComputedStyle(div).getPropertyValue(property); | |
| 18 document.body.removeChild(div); | |
| 19 return computedValue; | |
| 20 } | |
| 21 | |
| 22 function computedStyleRect(property, value) { | |
| 23 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); | |
| 24 document.getElementById("svg").appendChild(rect); | |
| 25 rect.setAttribute(property, value); | |
| 26 var computedValue = getComputedStyle(rect).getPropertyValue(property); | |
| 27 document.getElementById("svg").removeChild(rect); | |
| 28 return computedValue; | |
| 29 } | |
| 30 | |
| 31 | |
| 32 function testComputed(property, value, expected) { | |
| 33 shouldBeEqualToString('computedStyleDiv("' + property + '", "' + value + '") ', expected); | |
| 34 shouldBeEqualToString('computedStyleRect("' + property + '", "' + value + '" )', expected); | |
| 35 } | |
| 36 | |
| 37 testComputed("word-spacing", "1ex", "12.8000001907349px"); | |
|
eae
2015/03/05 19:39:44
I'd rather not add yet another test that depends o
Erik Dahlström (inactive)
2015/03/06 09:05:01
Done.
| |
| 38 </script> | |
| 39 </body> | |
| 40 </html> | |
| OLD | NEW |