https://github.com/web-platform-tests/wpt
Raw File
Tip revision: c6fbe7e7254917992588d44e082a540b37abd035 authored by Josh Matthews on 14 March 2018, 15:06:50 UTC
Add a lint to catch adding files that would otherwise be ignored by git.
Tip revision: c6fbe7e
url-encoded.html
<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id=testframe src="/common/blank.html"></iframe>
<script>
var simple_tests = [
  {
    name: "text.simple",
    input: "<input name=foo value=bara>",
    output: "foo=bara"
  },
  {
    name: "textarea.simple",
    input: "<textarea name=foo>bar</textarea>",
    output: "foo=bar"
  },
  {
    name: "nokeygen.simple",
    input: "<input name=foo value=barb><keygen>",
    output: "foo=barb"
  }
];
simple_tests.forEach(function(test_obj) {
  test_obj.test = async_test(test_obj.name);
});
function run_simple_test() {
  if (simple_tests.length == 0) {
    return;
  }
  test_obj = simple_tests.pop();
  var t = test_obj.test;
  var testframe = document.getElementById("testframe");
  var testdocument = testframe.contentWindow.document;
  testdocument.body.innerHTML =
    "<form id=testform action=\"/common/blank.html\">" +
    test_obj.input +
    "</form>";
  testframe.onload = function() {
    t.step(function (){
      var get_url = testframe.contentWindow.location.toString();
      var encoded = get_url.substr(get_url.indexOf("?") + 1);
      assert_equals(encoded, test_obj.output);
    });
    t.done();
    run_simple_test();
  };
  testdocument.getElementById("testform").submit();
}
document.getElementById("testframe").onload = run_simple_test;
</script>
back to top