summaryrefslogtreecommitdiffstats
path: root/dom/html/test/forms/test_form_attributes_reflection.html
blob: 0d0ef6b8704458a88709dd0d00863c5fd72f91d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE HTML>
<html>
<head>
  <title>Test for HTMLFormElement attributes reflection</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript" src="../reflect.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">

/** Test for HTMLFormElement attributes reflection **/

// .acceptCharset
reflectString({
  element: document.createElement("form"),
  attribute: { idl: "acceptCharset", content: "accept-charset" },
  otherValues: [ "ISO-8859-1", "UTF-8" ],
});

reflectURL({
  element: document.createElement("form"),
  attribute: "action",
});

// .autocomplete
reflectLimitedEnumerated({
  element: document.createElement("form"),
  attribute: "autocomplete",
  validValues: [ "on", "off" ],
  invalidValues: [ "", "foo", "tulip", "default" ],
  defaultValue: "on",
});

// .enctype
reflectLimitedEnumerated({
  element: document.createElement("form"),
  attribute: "enctype",
  validValues: [ "application/x-www-form-urlencoded", "multipart/form-data",
                 "text/plain" ],
  invalidValues: [ "", "foo", "tulip", "multipart/foo" ],
  defaultValue: "application/x-www-form-urlencoded"
});

// .encoding
reflectLimitedEnumerated({
  element: document.createElement("form"),
  attribute: { idl: "encoding", content: "enctype" },
  validValues: [ "application/x-www-form-urlencoded", "multipart/form-data",
                 "text/plain" ],
  invalidValues: [ "", "foo", "tulip", "multipart/foo" ],
  defaultValue: "application/x-www-form-urlencoded"
});

// .method
reflectLimitedEnumerated({
  element: document.createElement("form"),
  attribute: "method",
  validValues: [ "get", "post" ],
  invalidValues: [ "", "foo", "tulip" ],
  defaultValue: "get"
});

// .name
reflectString({
  element: document.createElement("form"),
  attribute: "name",
});

// .noValidate
reflectBoolean({
  element: document.createElement("form"),
  attribute: "noValidate",
});

// .target
reflectString({
  element: document.createElement("form"),
  attribute: "target",
  otherValues: [ "_blank", "_self", "_parent", "_top" ],
});

</script>
</pre>
</body>
</html>