https://github.com/web-platform-tests/wpt
Raw File
Tip revision: cf94be3b1a0f78b0ecb5e812ecc81f9d5f561cef authored by Eric Willigers on 03 October 2017, 02:38:14 UTC
CSS Motion Path: support <size> for ray paths
Tip revision: cf94be3
button-type.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTMLButtonElement.prototype.type</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-button-type">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>
"use strict";

test(() => {

  const button = document.createElement("button");
  assert_equals(button.type, "submit");

}, "a button's type should be submit by default");

test(() => {

  const button = document.createElement("button");

  for (const type of ["reset", "button", "submit"]) {
    button.type = type;
    assert_equals(button.type, type);

    button.type = type.toUpperCase();
    assert_equals(button.type, type);
  }

  button.type = "reset";
  button.type = "asdfgdsafd";
  assert_equals(button.type, "submit");

  button.type = "reset";
  button.type = "";
  assert_equals(button.type, "submit");

}, "a button's type should stay within the range of valid values");

</script>
back to top