OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 <script src="resources/common.js"></script> | 5 <script src="resources/common.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 <div id="elements"> | 9 <div id="elements"> |
10 <fieldset name=name01></fieldset> | 10 <fieldset name=name01></fieldset> |
(...skipping 26 matching lines...) Expand all Loading... |
37 <select name=name26 ></select> | 37 <select name=name26 ></select> |
38 <select name=name27 multiple></select> | 38 <select name=name27 multiple></select> |
39 <textarea name=name28></textarea> | 39 <textarea name=name28></textarea> |
40 <keygen name=name29> | 40 <keygen name=name29> |
41 <output name=name30></output> | 41 <output name=name30></output> |
42 </div> | 42 </div> |
43 <script> | 43 <script> |
44 console.log('Test if state of stateless form control types are not saved.'); | 44 console.log('Test if state of stateless form control types are not saved.'); |
45 jsTestIsAsync = true; | 45 jsTestIsAsync = true; |
46 | 46 |
47 function dumpFormState() { | 47 if (window.internals) { |
48 if (window.internals) { | 48 var statefulTypes = ['hidden', 'text', 'tel', 'url', 'email', 'number', 'ran
ge', 'checkbox', |
49 var statefulTypes = ['hidden', 'text', 'tel', 'url', 'email', 'number',
'range', 'checkbox', | 49 'radio', 'file', 'select-one', 'select-multiple', 't
extarea']; |
50 'radio', 'file', 'select-one', 'select-multiple', '
textarea']; | 50 var statelessTypes = ['fieldset', 'password', 'submit', 'reset', 'button', '
keygen', 'output']; |
51 var statelessTypes = ['fieldset', 'password', 'submit', 'reset', 'button
', 'keygen', 'output']; | |
52 | 51 |
53 var states = internals.formControlStateOfHistoryItem(); | 52 var states = internals.formControlStateOfHistoryItem(); |
54 for (var i = 0; i < statefulTypes.length; ++i) { | 53 for (var i = 0; i < statefulTypes.length; ++i) { |
55 if (states.indexOf(statefulTypes[i]) >= 0) | 54 if (states.indexOf(statefulTypes[i]) >= 0) |
56 testPassed('There is a state for ' + statefulTypes[i]); | 55 testPassed('There is a state for ' + statefulTypes[i]); |
57 else | 56 else |
58 testFailed('There no state for ' + statefulTypes[i]); | 57 testFailed('There no state for ' + statefulTypes[i]); |
59 } | 58 } |
60 | 59 |
61 for (var i = 0; i < statelessTypes.length; ++i) { | 60 for (var i = 0; i < statelessTypes.length; ++i) { |
62 if (states.indexOf(statelessTypes[i]) < 0) | 61 if (states.indexOf(statelessTypes[i]) < 0) |
63 testPassed('There is no state for ' + statelessTypes[i]); | 62 testPassed('There is no state for ' + statelessTypes[i]); |
64 else | 63 else |
65 testFailed('There is a state for ' + statelessTypes[i]); | 64 testFailed('There is a state for ' + statelessTypes[i]); |
66 } | |
67 } | 65 } |
68 // Remove the input elements from the document to avoid a bunch of trailing | |
69 // whitespace in the test output. | |
70 document.body.removeChild(document.getElementById("elements")); | |
71 finishJSTest(); | |
72 } | 66 } |
73 | 67 // Remove the input elements from the document to avoid a bunch of trailing |
74 window.onload = function() { | 68 // whitespace in the test output. |
75 setTimeout(function() { | 69 document.body.removeChild(document.getElementById("elements")); |
76 location.reload(); | 70 finishJSTest(); |
77 }, 0); | |
78 }; | |
79 window.onunload = function() { | |
80 dumpFormState(); | |
81 location.hash = "#done"; | |
82 }; | |
83 </script> | 71 </script> |
84 </body> | 72 </body> |
OLD | NEW |