| OLD | NEW |
| (Empty) |
| 1 description('Various tests for the figcaption element.'); | |
| 2 | |
| 3 function getStyleValue(id, propertyName) { | |
| 4 return document.defaultView.getComputedStyle(document.getElementById(id), nu
ll).getPropertyValue(propertyName); | |
| 5 } | |
| 6 | |
| 7 var testParent = document.createElement('div'); | |
| 8 document.body.appendChild(testParent); | |
| 9 | |
| 10 debug('<figcaption> default styling:'); | |
| 11 testParent.innerHTML = '<figcaption id="figcaption0">element</figure>'; | |
| 12 var emSize = getStyleValue("figcaption0","font-size"); | |
| 13 shouldBe('getStyleValue("figcaption0","display")', '"block"'); | |
| 14 | |
| 15 debug('<figcaption> closes <p>:'); | |
| 16 testParent.innerHTML = '<p>Test that <figcaption id="figcaption1">a figcaption e
lement</figcaption> closes <p>.</p>'; | |
| 17 var figcaption1 = document.getElementById('figcaption1'); | |
| 18 shouldBeFalse('figcaption1.parentNode.nodeName == "p"'); | |
| 19 | |
| 20 debug('<p> does not close <figcaption>:'); | |
| 21 testParent.innerHTML = '<figcaption>Test that <p id="p1">a p element</p> does no
t close a figcaption element.</figcaption>'; | |
| 22 var p1 = document.getElementById('p1'); | |
| 23 shouldBe('p1.parentNode.nodeName', '"FIGCAPTION"'); | |
| 24 | |
| 25 debug('<figcaption> can be nested inside <figcaption> or <footer>:'); | |
| 26 testParent.innerHTML = '<figcaption id="figcaption2">Test that <figcaption id="f
igcaption3">a figcaption element</figcaption> can be nested inside another figca
ption element.</figcaption>'; | |
| 27 var figcaption3 = document.getElementById('figcaption3'); | |
| 28 shouldBe('figcaption3.parentNode.id', '"figcaption2"'); | |
| 29 testParent.innerHTML = '<footer id="footer1">Test that <figcaption id="figcaptio
n5">a figcaption element</figcaption> can be nested inside a footer element.</fo
oter>'; | |
| 30 var figcaption5 = document.getElementById('figcaption5'); | |
| 31 shouldBe('figcaption5.parentNode.id', '"footer1"'); | |
| 32 | |
| 33 debug('Residual style:'); | |
| 34 testParent.innerHTML = '<b><figcaption id="figcaption4">This text should be bold
.</figcaption> <span id="span1">This is also bold.</span></b>'; | |
| 35 shouldBe('getStyleValue("figcaption4","font-weight")', '"bold"'); | |
| 36 shouldBe('getStyleValue("span1","font-weight")', '"bold"'); | |
| 37 document.body.removeChild(testParent); | |
| 38 | |
| OLD | NEW |