OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Distributed under both the W3C Test Suite License [1] and the W3C |
| 4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
| 5 policies and contribution forms [3]. |
| 6 |
| 7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
| 8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
| 9 [3] http://www.w3.org/2004/10/27-testcases |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <title>Shadow DOM Test: A_08_02_03</title> |
| 14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> |
| 15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#inert-h
tml-elements"> |
| 16 <meta name="assert" content="HTML Elements in shadow trees: form should submit e
lements in shadow tree"> |
| 17 <script src="../../../../../resources/testharness.js"></script> |
| 18 <script src="../../../../../resources/testharnessreport.js"></script> |
| 19 <script src="../../testcommon.js"></script> |
| 20 <link rel="stylesheet" href="../../../../../resources/testharness.css"> |
| 21 </head> |
| 22 <body> |
| 23 <div id="log"></div> |
| 24 <script> |
| 25 var A_08_02_03_T01 = async_test('A_08_02_03_T01', { timeout: 5000 }); |
| 26 |
| 27 A_08_02_03_T01.checkIframeContent = A_08_02_03_T01.step_func(function () { |
| 28 //remember value to check before cleaning the context (it'll destroy the
iframe) |
| 29 var valueToCheck = A_08_02_03_T01.iframe.contentWindow.document.URL; |
| 30 cleanContext(A_08_02_03_T01.ctx); |
| 31 |
| 32 assert_true(valueToCheck.indexOf('inp1=value1') > 0, |
| 33 'html form should submit all of its fields'); |
| 34 |
| 35 // Expected behavior is not quite clear. See https://www.w3.org/Bugs/Pub
lic/show_bug.cgi?id=20320 |
| 36 assert_true(valueToCheck.indexOf('inp2=value2') > 0, |
| 37 'html form should submit all of its fields including the shadow
ones'); |
| 38 |
| 39 A_08_02_03_T01.done(); |
| 40 }); |
| 41 |
| 42 |
| 43 A_08_02_03_T01.step(function () { |
| 44 |
| 45 A_08_02_03_T01.ctx = newContext(); |
| 46 var d = newRenderedHTMLDocument(A_08_02_03_T01.ctx); |
| 47 |
| 48 //create iframe |
| 49 var iframe = document.createElement('iframe'); |
| 50 |
| 51 iframe.src = '../../resources/blank.html'; |
| 52 iframe.setAttribute('name', 'targetIframe'); |
| 53 d.body.appendChild(iframe); |
| 54 |
| 55 A_08_02_03_T01.iframe = iframe; |
| 56 |
| 57 // create form |
| 58 var form = d.createElement('form'); |
| 59 form.setAttribute('target', 'targetIframe'); |
| 60 form.setAttribute('method', 'GET'); |
| 61 form.setAttribute('action', '../../resources/blank.html'); |
| 62 d.body.appendChild(form); |
| 63 |
| 64 //create Shadow root |
| 65 var root = d.createElement('div'); |
| 66 form.appendChild(root); |
| 67 var s = root.createShadowRoot(); |
| 68 |
| 69 |
| 70 var input1 = d.createElement('input'); |
| 71 input1.setAttribute('type', 'text'); |
| 72 input1.setAttribute('name', 'inp1'); |
| 73 input1.setAttribute('value', 'value1'); |
| 74 form.appendChild(input1); |
| 75 |
| 76 var input2 = d.createElement('input'); |
| 77 input2.setAttribute('type', 'text'); |
| 78 input2.setAttribute('name', 'inp2'); |
| 79 input2.setAttribute('value', 'value2'); |
| 80 s.appendChild(input2); |
| 81 |
| 82 //submit the form |
| 83 form.submit(); |
| 84 |
| 85 // set timeout to give the iframe time to load content |
| 86 setTimeout('A_08_02_03_T01.checkIframeContent()', 2000); |
| 87 }); |
| 88 </script> |
| 89 </body> |
| 90 </html> |
OLD | NEW |