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