| description('Tests the behavior of .formaction, .formenctype, .formmethod and .formtarget of HTMLInputElement and HTMLButtonElement.'); |
| |
| var input = document.createElement('input'); |
| |
| debug('Ordinary values for input:'); |
| input.type = "submit"; |
| shouldBe('input.formAction', '""'); |
| shouldBe('input.formEnctype', '""'); |
| shouldBe('input.formMethod', '""'); |
| shouldBe('input.formTarget', '""'); |
| |
| input.setAttribute('formAction', 'http://localhost'); |
| shouldBe('input.formAction', '"http://localhost/"'); |
| input.setAttribute('formAction', 'http://localhost/'); |
| shouldBe('input.formAction', '"http://localhost/"'); |
| input.setAttribute('formEnctype', 'text/plain'); |
| shouldBe('input.formEnctype', '"text/plain"'); |
| input.setAttribute('formEnctype', 'na'); |
| shouldBe('input.formEnctype', '"na"'); |
| input.setAttribute('formMethod', 'GET'); |
| shouldBe('input.formMethod', '"GET"'); |
| input.setAttribute('formMethod', 'ni'); |
| shouldBe('input.formMethod', '"ni"'); |
| input.setAttribute('formTarget', '_blank'); |
| shouldBe('input.formTarget', '"_blank"'); |
| input.setAttribute('formTarget', 'nu'); |
| shouldBe('input.formTarget', '"nu"'); |
| |
| input.formAction = 'http://example.com'; |
| shouldBe('input.formAction', '"http://example.com/"'); |
| input.formAction = 'http://example.com/'; |
| shouldBe('input.formAction', '"http://example.com/"'); |
| input.formEnctype = 'text/plain'; |
| shouldBe('input.formEnctype', '"text/plain"'); |
| input.formEnctype = 'nota'; |
| shouldBe('input.formEnctype', '"nota"'); |
| input.formMethod = 'POST'; |
| shouldBe('input.formMethod', '"POST"'); |
| input.formMethod = 'neta'; |
| shouldBe('input.formMethod', '"neta"'); |
| input.formTarget = 'http://example.com'; |
| shouldBe('input.formTarget', '"http://example.com"'); |
| input.formTarget = 'nta'; |
| shouldBe('input.formTarget', '"nta"'); |
| |
| debug('Setting null for input:'); |
| input.formEnctype = null; |
| shouldBe('input.formEnctype', '""'); |
| shouldBe('input.getAttribute("formEnctype")', 'null'); |
| input.setAttribute('formEnctype', null); |
| shouldBe('input.formEnctype', '"null"'); |
| input.formMethod = null; |
| shouldBe('input.formMethod', '""'); |
| shouldBe('input.getAttribute("formMethod")', 'null'); |
| input.setAttribute('formMethod', null); |
| shouldBe('input.formMethod', '"null"'); |
| input.formTarget = null; |
| shouldBe('input.formTarget', '""'); |
| shouldBe('input.getAttribute("formTarget")', 'null'); |
| input.setAttribute('formTarget', null); |
| shouldBe('input.formTarget', '"null"'); |
| |
| debug('Setting undefined for input:'); |
| input.formEnctype = undefined; |
| shouldBe('input.formEnctype', '"undefined"'); |
| shouldBe('input.getAttribute("formEnctype")', '"undefined"'); |
| input.setAttribute('formEnctype', undefined); |
| shouldBe('input.formEnctype', '"undefined"'); |
| input.formMethod = undefined; |
| shouldBe('input.formMethod', '"undefined"'); |
| shouldBe('input.getAttribute("formMethod")', '"undefined"'); |
| input.setAttribute('formMethod', undefined); |
| shouldBe('input.formMethod', '"undefined"'); |
| input.formTarget = undefined; |
| shouldBe('input.formTarget', '"undefined"'); |
| shouldBe('input.getAttribute("formTarget")', '"undefined"'); |
| input.setAttribute('formTarget', undefined); |
| shouldBe('input.formTarget', '"undefined"'); |
| |
| debug('Setting non-string for input:'); |
| input.formEnctype = 256; |
| shouldBe('input.formEnctype', '"256"'); |
| shouldBe('input.getAttribute("formEnctype")', '"256"'); |
| input.setAttribute('formEnctype', 256); |
| shouldBe('input.formEnctype', '"256"'); |
| input.formMethod = 256; |
| shouldBe('input.formMethod', '"256"'); |
| shouldBe('input.getAttribute("formMethod")', '"256"'); |
| input.setAttribute('formMethod', 256); |
| shouldBe('input.formMethod', '"256"'); |
| input.formTarget = 256; |
| shouldBe('input.formTarget', '"256"'); |
| shouldBe('input.getAttribute("formTarget")', '"256"'); |
| input.setAttribute('formTarget', 256); |
| shouldBe('input.formTarget', '"256"'); |
| |
| var button = document.createElement('button'); |
| |
| debug('Ordinary values for button:'); |
| button.type = "submit"; |
| shouldBe('button.formAction', '""'); |
| shouldBe('button.formEnctype', '""'); |
| shouldBe('button.formMethod', '""'); |
| shouldBe('button.formTarget', '""'); |
| |
| button.setAttribute('formAction', 'http://localhost'); |
| shouldBe('button.formAction', '"http://localhost/"'); |
| button.setAttribute('formAction', 'http://localhost/'); |
| shouldBe('button.formAction', '"http://localhost/"'); |
| button.setAttribute('formEnctype', 'text/plain'); |
| shouldBe('button.formEnctype', '"text/plain"'); |
| button.setAttribute('formEnctype', 'na'); |
| shouldBe('button.formEnctype', '"na"'); |
| button.setAttribute('formMethod', 'GET'); |
| shouldBe('button.formMethod', '"GET"'); |
| button.setAttribute('formMethod', 'na'); |
| shouldBe('button.formMethod', '"na"'); |
| button.setAttribute('formTarget', '_blank'); |
| shouldBe('button.formTarget', '"_blank"'); |
| button.setAttribute('formTarget', 'na'); |
| shouldBe('button.formTarget', '"na"'); |
| |
| button.formAction = 'http://example.com'; |
| shouldBe('button.formAction', '"http://example.com/"'); |
| button.formAction = 'http://example.com/'; |
| shouldBe('button.formAction', '"http://example.com/"'); |
| button.formEnctype = 'text/plain'; |
| shouldBe('button.formEnctype', '"text/plain"'); |
| button.formEnctype = 'nota'; |
| shouldBe('button.formEnctype', '"nota"'); |
| button.formMethod = 'POST'; |
| shouldBe('button.formMethod', '"POST"'); |
| button.formMethod = 'nota'; |
| shouldBe('button.formMethod', '"nota"'); |
| button.formTarget = 'http://example.com'; |
| shouldBe('button.formTarget', '"http://example.com"'); |
| button.formTarget = 'nota'; |
| shouldBe('button.formTarget', '"nota"'); |
| |
| debug('Setting null for button:'); |
| button.formEnctype = null; |
| shouldBe('button.formEnctype', '""'); |
| shouldBe('button.getAttribute("formEnctype")', 'null'); |
| button.setAttribute('formEnctype', null); |
| shouldBe('button.formEnctype', '"null"'); |
| button.formMethod = null; |
| shouldBe('button.formMethod', '""'); |
| shouldBe('button.getAttribute("formMethod")', 'null'); |
| button.setAttribute('formMethod', null); |
| shouldBe('button.formMethod', '"null"'); |
| button.formTarget = null; |
| shouldBe('button.formTarget', '""'); |
| shouldBe('button.getAttribute("formTarget")', 'null'); |
| button.setAttribute('formTarget', null); |
| shouldBe('button.formTarget', '"null"'); |
| |
| debug('Setting undefined for button:'); |
| button.formEnctype = undefined; |
| shouldBe('button.formEnctype', '"undefined"'); |
| shouldBe('button.getAttribute("formEnctype")', '"undefined"'); |
| button.setAttribute('formEnctype', undefined); |
| shouldBe('button.formEnctype', '"undefined"'); |
| button.formMethod = undefined; |
| shouldBe('button.formMethod', '"undefined"'); |
| shouldBe('button.getAttribute("formMethod")', '"undefined"'); |
| button.setAttribute('formMethod', undefined); |
| shouldBe('button.formMethod', '"undefined"'); |
| button.formTarget = undefined; |
| shouldBe('button.formTarget', '"undefined"'); |
| shouldBe('button.getAttribute("formTarget")', '"undefined"'); |
| button.setAttribute('formTarget', undefined); |
| shouldBe('button.formTarget', '"undefined"'); |
| |
| debug('Setting non-string for button:'); |
| button.formEnctype = 256; |
| shouldBe('button.formEnctype', '"256"'); |
| shouldBe('button.getAttribute("formEnctype")', '"256"'); |
| button.setAttribute('formEnctype', 512); |
| shouldBe('button.formEnctype', '"512"'); |
| button.formMethod = 128; |
| shouldBe('button.formMethod', '"128"'); |
| shouldBe('button.getAttribute("formMethod")', '"128"'); |
| button.setAttribute('formMethod', 17); |
| shouldBe('button.formMethod', '"17"'); |
| button.formTarget = 100; |
| shouldBe('button.formTarget', '"100"'); |
| shouldBe('button.getAttribute("formTarget")', '"100"'); |
| button.setAttribute('formTarget', 281); |
| shouldBe('button.formTarget', '"281"'); |
| |
| var successfullyParsed = true; |