test-010.html (2412B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Shadow DOM Test: A_10_01_01_04_02</title> 5 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> 6 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-root-attributes"> 7 <meta name="assert" content="ShadowRoot Object: innerHTML of type DOMString; Test setter"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="../../../../../html/resources/common.js"></script> 11 <script src="../../../../resources/shadow-dom-utils.js"></script> 12 </head> 13 <body> 14 <div id="log"></div> 15 <script> 16 test(unit(function (ctx) { 17 18 var d = newRenderedHTMLDocument(ctx); 19 20 var host = d.createElement('div'); 21 d.body.appendChild(host); 22 var s = host.attachShadow({mode: 'open'}); 23 24 var span = d.createElement('span'); 25 span.innerHTML = 'Some text'; 26 s.appendChild(span); 27 28 s.innerHTML = '<input type="text"><div>new text</div>'; 29 30 assert_equals(s.innerHTML.toLowerCase(), '<input type="text"><div>new text</div>', 31 'Wrong value of ShadowRoot innerHTML attribute'); 32 33 }), 'A_10_01_01_04_02_T01_01'); 34 35 36 test(unit(function (ctx) { 37 38 var d = newRenderedHTMLDocument(ctx); 39 40 var host = d.createElement('div'); 41 d.body.appendChild(host); 42 var s = host.attachShadow({mode: 'open'}); 43 44 var span = d.createElement('span'); 45 span.setAttribute('id', 'spanId'); 46 span.innerHTML = 'Some text'; 47 s.appendChild(span); 48 49 s.innerHTML = '<input type="text" id="inputId"><div id="divId">new text</div>'; 50 51 assert_equals(s.querySelector('#spanId'), null, 'Point 1:innerHTML attribute must replace all content of ' + 52 'the ShadowRoot object'); 53 54 assert_true(s.querySelector('#inputId') != null, 'Point 2:innerHTML attribute must replace all content of ' + 55 'the ShadowRoot object'); 56 assert_equals(s.querySelector('#inputId').getAttribute('id'), 'inputId', 57 'Point 3:innerHTML attribute must replace all content of the ShadowRoot object'); 58 59 assert_true(s.querySelector('#divId') != null, 'Point 3:innerHTML attribute must replace all content of ' + 60 'the ShadowRoot object'); 61 assert_equals(s.querySelector('#divId').getAttribute('id'), 'divId', 62 'Point 4:innerHTML attribute must replace all content of the ShadowRoot object'); 63 }), 'A_10_01_01_04_02_T01_02'); 64 </script> 65 </body> 66 </html>