Skip to content

Commit

Permalink
Add test for encoding text/plain in forms
Browse files Browse the repository at this point in the history
  • Loading branch information
KiChjang committed May 12, 2016
1 parent d1c0af9 commit 5e07887
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/wpt/web-platform-tests/common/form-submission.py
Expand Up @@ -4,6 +4,11 @@ def main(request, response):
return 'OK'
else:
return 'FAIL'
elif request.headers.get('Content-Type') == 'text/plain':
if request.body == 'qux=baz\r\n':
return 'OK'
else:
return 'FAIL'
else:
if request.POST.first('foo') == 'bar':
return 'OK'
Expand Down
Expand Up @@ -18,6 +18,13 @@
submitelement: "",
submitaction: function(doc) { doc.getElementById("testform").submit(); }
},
{
name: "form submission from form should navigate to url with text/plain",
input: "<textarea name=qux>baz</textarea>",
enctype: "text/plain",
submitelement: "",
submitaction: function(doc) { doc.getElementById("testform").submit(); }
},
{
name: "form submission from button should navigate to url with x-www-form-urlencoded",
input: "<input name=foo value=bara>",
Expand All @@ -32,6 +39,13 @@
submitelement: "<button id=buttonsubmit type=\"submit\">Submit</button>",
submitaction: function(doc) { doc.getElementById("buttonsubmit").click(); }
},
{
name: "form submission from button should navigate to url with text/plain",
input: "<textarea name=qux>baz</textarea>",
enctype: "text/plain",
submitelement: "<button id=buttonsubmit type=\"submit\">Submit</button>",
submitaction: function(doc) { doc.getElementById("buttonsubmit").click(); }
},
{
name: "form submission from input should navigate to url with x-www-form-urlencoded",
input: "<input name=foo value=bara>",
Expand All @@ -46,6 +60,13 @@
submitelement: "<input id=inputsubmit type=\"submit\">Submit</input>",
submitaction: function(doc) { doc.getElementById("inputsubmit").click(); }
},
{
name: "form submission from input should navigate to url with text/plain",
input: "<input name=qux value=baz>",
enctype: "text/plain",
submitelement: "<input id=inputsubmit type=\"submit\">Submit</input>",
submitaction: function(doc) { doc.getElementById("inputsubmit").click(); }
}
];
simple_tests.forEach(function(test_obj) {
test_obj.test = async_test(test_obj.name);
Expand Down

0 comments on commit 5e07887

Please sign in to comment.