Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <p>Test that computed style for text-decoration is correctly represented.</p> | |
| 3 <div id="target" style="text-decoration: underline;">This text should be underli ned.</div> | |
| 4 <pre id="result"></pre> | |
| 5 <script> | |
| 6 if (window.testRunner) | |
| 7 testRunner.dumpAsText(); | |
| 8 | |
| 9 function testDecoration(elm) { | |
| 10 var decoration = getComputedStyle(elm).textDecoration; | |
| 11 | |
| 12 // Checking the start of the result string is the best we can do here, | |
| 13 // because we expect different results depending on whether experimental | |
| 14 // features are enabled or not. | |
| 15 // | |
| 16 // The important thing is that the computed value for text-decoration | |
| 17 // ends up in the text output somehow. | |
| 18 var expectedStart = "underline"; | |
| 19 if (decoration.substr(0, expectedStart.length) != expectedStart) | |
| 20 throw "Incorrect computed style: " + decoration + ". " + | |
| 21 "Expected something that starts with: " + expectedStart; | |
| 22 | |
| 23 return decoration; | |
| 24 } | |
| 25 | |
| 26 try { | |
| 27 result.innerText = "PASS: " + testDecoration(target); | |
| 28 } catch (e) { | |
| 29 result.innerText = "FAIL: " + e; | |
| 30 } | |
| 31 </script> | |
|
rune
2014/05/16 22:20:09
If you use js-test.js, you could do something like
andersr
2014/05/19 08:10:18
Ah, wasn't aware that it existed. Done!
| |
| OLD | NEW |