| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <script> |
| description('Various tests for the aside element.'); |
| |
| var testParent = document.createElement('div'); |
| document.body.appendChild(testParent); |
| |
| debug('<aside> closes <p>:'); |
| testParent.innerHTML = '<p>Test that <aside id="aside1">an aside element</aside> closes <p>.</p>'; |
| var aside1 = document.getElementById('aside1'); |
| shouldBeFalse('aside1.parentNode.nodeName == "p"'); |
| |
| debug('<p> does not close <aside>:'); |
| testParent.innerHTML = '<aside>Test that <p id="p1">a p element</p> does not close an aside element.</aside>'; |
| var p1 = document.getElementById('p1'); |
| shouldBe('p1.parentNode.nodeName', '"ASIDE"'); |
| |
| debug('<aside> can be nested inside <aside>:'); |
| testParent.innerHTML = '<aside id="aside2">Test that <aside id="aside3">an aside element</aside> can be nested inside another.</aside>'; |
| var aside3 = document.getElementById('aside3'); |
| shouldBe('aside3.parentNode.id', '"aside2"'); |
| |
| debug('Residual style:'); |
| testParent.innerHTML = '<b><aside id="aside4">This text should be bold.</aside> <span id="span1">This is also bold.</span></b>'; |
| function getWeight(id) { |
| return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('font-weight'); |
| } |
| shouldBe('getWeight("aside4")', '"700"'); |
| shouldBe('getWeight("span1")', '"700"'); |
| document.body.removeChild(testParent); |
| |
| debug('FormatBlock:'); |
| var editable = document.createElement('div'); |
| editable.innerHTML = '[<span id="span2">The text will be a child of <aside>.</span>]'; |
| document.body.appendChild(editable); |
| editable.contentEditable = true; |
| var selection = window.getSelection(); |
| selection.selectAllChildren(editable); |
| document.execCommand('FormatBlock', false, 'aside'); |
| selection.collapse(null); |
| shouldBe('document.getElementById("span2").parentNode.nodeName', '"ASIDE"'); |
| document.body.removeChild(editable); |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |