blob: e5bdf7f1cbadf6a3f506227137cf804fb5b0f821 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<p>Test enctype and formenctype attributes</p>
<form id=f1></form>
<div id=console></div>
<script>
var form1 = document.getElementById('f1');
debug('Missing value default:');
shouldBe('form1.enctype', '"application/x-www-form-urlencoded"');
shouldBeNull('form1.getAttribute("enctype")');
debug('');
debug('Invalid value default:');
shouldBe('form1.enctype = "foobar"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.getAttribute("enctype")', '"foobar"');
shouldBe('form1.setAttribute("enctype", "baz"); form1.enctype', '"application/x-www-form-urlencoded"');
debug('');
debug('Text and its subtypes:');
shouldBe('form1.enctype = "text"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "plain"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/1d-interleaved-parityfec"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/calendar"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/css"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/csv"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/dns"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/enriched"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/example"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/fwdred"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/html"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/rfc822-headers"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/richtext"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/rtx"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/sgml"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/t140"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/troff"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/ulpfec"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/uri-list"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/vcard"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/xml"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "text/xml-external-parsed-entity"; form1.enctype', '"application/x-www-form-urlencoded"');
debug('');
debug('Multipart and its subtypes:');
shouldBe('form1.enctype = "multipart"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "form-data"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/mixed"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/message"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/digest"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/alternative"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/alternative"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/byteranges"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/encrypted"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/example"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/parallel"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/related"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/report"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.enctype = "multipart/signed"; form1.enctype', '"application/x-www-form-urlencoded"');
debug('');
debug('Valid values:');
shouldBe('form1.enctype = "Text/Plain"; form1.enctype', '"text/plain"');
shouldBe('form1.getAttribute("enctype")', '"Text/Plain"');
shouldBe('form1.setAttribute("enctype", "Text/Plain"); form1.enctype', '"text/plain"');
shouldBe('form1.enctype = "Multipart/Form-Data"; form1.enctype', '"multipart/form-data"');
shouldBe('form1.getAttribute("enctype")', '"Multipart/Form-Data"');
shouldBe('form1.setAttribute("enctype", "Multipart/Form-Data"); form1.enctype', '"multipart/form-data"');
debug('');
debug('Values with whitespace:');
// Note: IE9 thorws "Invalid argument.", Firefox 6 doesn't allow leading whitespace.
// Firefox matches to the specification.
shouldBe('form1.enctype = " multipart/form-data"; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.getAttribute("enctype")', '" multipart/form-data"');
shouldBe('form1.enctype = "multipart/form-data "; form1.enctype', '"application/x-www-form-urlencoded"');
shouldBe('form1.getAttribute("enctype")', '"multipart/form-data "');
shouldBe('form1.enctype = "application/x-www-form-urlencoded "; form1.enctype', '"application/x-www-form-urlencoded"');
debug('');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>