summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-button-element/button-type-enumerated-ascii-case-insensitive.html
blob: 30a2c24a80bab390c3401ee70c8bdc985cd8a21d (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
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="help" href="https://html.spec.whatwg.org/#attr-button-type">
<link rel="help" href="https://html.spec.whatwg.org/#enumerated-attribute">
<meta name="assert" content="button@type values are ASCII case-insensitive">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<button type="reset">
<button type="ReSeT">
<button type="reſet">
<button type="submit">
<button type="SuBmIt">
<button type="ſubmit">
<script>
const button = document.querySelectorAll("button");

test(() => {
  assert_equals(button[0].type, "reset", "lowercase valid");
  assert_equals(button[1].type, "reset", "mixed case valid");
  assert_equals(button[2].type, "submit", "non-ASCII invalid");
}, "keyword reset");

test(() => {
  assert_equals(button[3].type, "submit", "lowercase valid");

  // vacuous: the invalid value default is currently submit, so even if the UA
  // treats this as invalid, the observable behaviour would still be correct
  assert_equals(button[4].type, "submit", "mixed case valid");

  // vacuous: the invalid value default is currently submit, so even if the UA
  // treats this as valid, the observable behaviour would still be correct
  assert_equals(button[5].type, "submit", "non-ASCII invalid");
}, "keyword submit");
</script>