1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description("This test checks a form element can handle elements of which form attribute points the form element even if elements are outside of the form.");
12 if (window
.testRunner
)
13 testRunner
.waitUntilDone();
15 var container
= document
.createElement('div');
16 document
.body
.appendChild(container
);
18 container
.innerHTML
= '<input type=hidden name=key1 value=value1 id=outer-before form=owner />' +
19 '<form id=owner action="" method="GET">' +
20 ' <input type=hidden name=key2 value=value2 id=inner form=owner />' +
22 '<input type=hidden name=submitted value=true id=outer-after form=owner />';
24 var owner
= document
.getElementById('owner');
25 var outerBefore
= document
.getElementById('outer-before');
26 var inner
= document
.getElementById('inner');
27 var outerAfter
= document
.getElementById('outer-after');
28 var query
= window
.location
.search
;
30 if (query
.indexOf('submitted=true') == -1) {
33 debug('- Ensures that elements attribute of the form contains elements which are outside of the form.');
35 shouldBe('owner.elements.length', '3');
36 shouldBe('owner.elements[0]', 'outerBefore');
37 shouldBe('owner.elements[1]', 'inner');
38 shouldBe('owner.elements[2]', 'outerAfter');
41 debug('- Ensures that form submission contains name and value pairs for such elements.');
42 var pairs
= query
.substr(1).split('&');
43 shouldBe('pairs.length', '3');
44 shouldBeEqualToString('pairs[0]', 'key1=value1');
45 shouldBeEqualToString('pairs[1]', 'key2=value2');
46 shouldBeEqualToString('pairs[2]', 'submitted=true');
47 if (window
.testRunner
)
48 testRunner
.notifyDone();