test_form_attributes_reflection.html (2283B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test for HTMLFormElement attributes reflection</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script type="application/javascript" src="../reflect.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 8 </head> 9 <body> 10 <p id="display"></p> 11 <div id="content" style="display: none"> 12 </div> 13 <pre id="test"> 14 <script type="application/javascript"> 15 16 /** Test for HTMLFormElement attributes reflection */ 17 18 // .acceptCharset 19 reflectString({ 20 element: document.createElement("form"), 21 attribute: { idl: "acceptCharset", content: "accept-charset" }, 22 otherValues: [ "ISO-8859-1", "UTF-8" ], 23 }); 24 25 reflectURL({ 26 element: document.createElement("form"), 27 attribute: "action", 28 }); 29 30 // .autocomplete 31 reflectLimitedEnumerated({ 32 element: document.createElement("form"), 33 attribute: "autocomplete", 34 validValues: [ "on", "off" ], 35 invalidValues: [ "", "foo", "tulip", "default" ], 36 defaultValue: "on", 37 }); 38 39 // .enctype 40 reflectLimitedEnumerated({ 41 element: document.createElement("form"), 42 attribute: "enctype", 43 validValues: [ "application/x-www-form-urlencoded", "multipart/form-data", 44 "text/plain" ], 45 invalidValues: [ "", "foo", "tulip", "multipart/foo" ], 46 defaultValue: "application/x-www-form-urlencoded" 47 }); 48 49 // .encoding 50 reflectLimitedEnumerated({ 51 element: document.createElement("form"), 52 attribute: { idl: "encoding", content: "enctype" }, 53 validValues: [ "application/x-www-form-urlencoded", "multipart/form-data", 54 "text/plain" ], 55 invalidValues: [ "", "foo", "tulip", "multipart/foo" ], 56 defaultValue: "application/x-www-form-urlencoded" 57 }); 58 59 // .method 60 reflectLimitedEnumerated({ 61 element: document.createElement("form"), 62 attribute: "method", 63 validValues: [ "get", "post" ], 64 invalidValues: [ "", "foo", "tulip" ], 65 defaultValue: "get" 66 }); 67 68 // .name 69 reflectString({ 70 element: document.createElement("form"), 71 attribute: "name", 72 }); 73 74 // .noValidate 75 reflectBoolean({ 76 element: document.createElement("form"), 77 attribute: "noValidate", 78 }); 79 80 // .target 81 reflectString({ 82 element: document.createElement("form"), 83 attribute: "target", 84 otherValues: [ "_blank", "_self", "_parent", "_top" ], 85 }); 86 87 </script> 88 </pre> 89 </body> 90 </html>