JS Test Harness: Insert the stylesheet dynamically
[WebKit-https.git] / LayoutTests / fast / forms / interactive-validation-required-radio.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <form id=f action="interactive-validation-required-radio.html">
10 <input type=hidden name=submitted value="true">
11 <input type=radio name=terms id=i0>
12 <input type=radio name=terms id=i1 required>
13 <input type=submit id="s">
14 </form>
15 <script>
16 description('There was a bug of validation of a required radio button. This test confirms the bug has been fixed.');
17
18 function startOrVerify() {
19     var query = window.location.search;
20     if (query.indexOf('submitted=true') != -1) {
21         testPassed('The form should be submitted.');
22         shouldBeTrue('location.search.indexOf("terms=on") != -1');
23         debug('TEST COMPLETE');
24         if (window.layoutTestController)
25             layoutTestController.notifyDone();
26     } else {
27         document.getElementById('i1').checked = true;
28         // HTMLFormElement::submit() skips validation. Use the submit button.
29         document.getElementById('s').click();
30         testFailed('The form was not submitted.');
31     }
32 }
33
34 if (window.layoutTestController)
35     layoutTestController.waitUntilDone();
36 window.onload = startOrVerify;
37 </script>
38 </body>
39 </html>