From d08d3053999619aa90469c07ee758cd036298a2b Mon Sep 17 00:00:00 2001 From: samu698 Date: Sun, 20 Oct 2024 18:39:50 +0200 Subject: [PATCH] LibWeb: Fixed IDL for HTMLInputElement Use Enumerated for the form{Enctype, Method} attributes --- .../expected/form-formEnctype-attribute.txt | 52 +++++++++++++++++++ .../expected/form-formMethod-attribute.txt | 52 +++++++++++++++++++ .../input/form-formEnctype-attribute.html | 13 +++++ .../Text/input/form-formMethod-attribute.html | 13 +++++ .../LibWeb/HTML/HTMLInputElement.idl | 4 +- 5 files changed, 132 insertions(+), 2 deletions(-) diff --git a/Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt b/Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt index 7d79d400f0d..076f45f0e28 100644 --- a/Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt +++ b/Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt @@ -49,3 +49,55 @@ button.formEnctype == 'application/x-www-form-urlencoded' button.setAttribute('formEnctype', '5%') button.getAttribute('formEnctype') == '5%' button.formEnctype == 'application/x-www-form-urlencoded' + +input: unset +input.getAttribute('formEnctype') == 'null' +input.formEnctype == '' + +input.setAttribute('formEnctype', '') +input.getAttribute('formEnctype') == '' +input.formEnctype == 'application/x-www-form-urlencoded' + +input.setAttribute('formEnctype', 'undefined') +input.getAttribute('formEnctype') == 'undefined' +input.formEnctype == 'application/x-www-form-urlencoded' + +input.setAttribute('formEnctype', 'null') +input.getAttribute('formEnctype') == 'null' +input.formEnctype == 'application/x-www-form-urlencoded' + +input.setAttribute('formEnctype', 'application/x-www-form-urlencoded') +input.getAttribute('formEnctype') == 'application/x-www-form-urlencoded' +input.formEnctype == 'application/x-www-form-urlencoded' + +input.setAttribute('formEnctype', 'multipart/form-data') +input.getAttribute('formEnctype') == 'multipart/form-data' +input.formEnctype == 'multipart/form-data' + +input.setAttribute('formEnctype', 'text/plain') +input.getAttribute('formEnctype') == 'text/plain' +input.formEnctype == 'text/plain' + +input.setAttribute('formEnctype', 'APPLICATION/X-WWW-FORM-URLENCODED') +input.getAttribute('formEnctype') == 'APPLICATION/X-WWW-FORM-URLENCODED' +input.formEnctype == 'application/x-www-form-urlencoded' + +input.setAttribute('formEnctype', 'MULTIPART/FORM-DATA') +input.getAttribute('formEnctype') == 'MULTIPART/FORM-DATA' +input.formEnctype == 'multipart/form-data' + +input.setAttribute('formEnctype', 'tEXt/PlAIn') +input.getAttribute('formEnctype') == 'tEXt/PlAIn' +input.formEnctype == 'text/plain' + +input.setAttribute('formEnctype', 'text/plain ') +input.getAttribute('formEnctype') == 'text/plain ' +input.formEnctype == 'application/x-www-form-urlencoded' + +input.setAttribute('formEnctype', '7') +input.getAttribute('formEnctype') == '7' +input.formEnctype == 'application/x-www-form-urlencoded' + +input.setAttribute('formEnctype', '5%') +input.getAttribute('formEnctype') == '5%' +input.formEnctype == 'application/x-www-form-urlencoded' diff --git a/Tests/LibWeb/Text/expected/form-formMethod-attribute.txt b/Tests/LibWeb/Text/expected/form-formMethod-attribute.txt index 79d2ce9b5f0..966061a5b27 100644 --- a/Tests/LibWeb/Text/expected/form-formMethod-attribute.txt +++ b/Tests/LibWeb/Text/expected/form-formMethod-attribute.txt @@ -49,3 +49,55 @@ button.formMethod == 'get' button.setAttribute('formMethod', '5%') button.getAttribute('formMethod') == '5%' button.formMethod == 'get' + +input: unset +input.getAttribute('formMethod') == 'null' +input.formMethod == '' + +input.setAttribute('formMethod', '') +input.getAttribute('formMethod') == '' +input.formMethod == 'get' + +input.setAttribute('formMethod', 'undefined') +input.getAttribute('formMethod') == 'undefined' +input.formMethod == 'get' + +input.setAttribute('formMethod', 'null') +input.getAttribute('formMethod') == 'null' +input.formMethod == 'get' + +input.setAttribute('formMethod', 'get') +input.getAttribute('formMethod') == 'get' +input.formMethod == 'get' + +input.setAttribute('formMethod', 'post') +input.getAttribute('formMethod') == 'post' +input.formMethod == 'post' + +input.setAttribute('formMethod', 'dialog') +input.getAttribute('formMethod') == 'dialog' +input.formMethod == 'dialog' + +input.setAttribute('formMethod', 'GeT') +input.getAttribute('formMethod') == 'GeT' +input.formMethod == 'get' + +input.setAttribute('formMethod', 'POST') +input.getAttribute('formMethod') == 'POST' +input.formMethod == 'post' + +input.setAttribute('formMethod', 'DIAlog') +input.getAttribute('formMethod') == 'DIAlog' +input.formMethod == 'dialog' + +input.setAttribute('formMethod', 'foo') +input.getAttribute('formMethod') == 'foo' +input.formMethod == 'get' + +input.setAttribute('formMethod', 'xpost') +input.getAttribute('formMethod') == 'xpost' +input.formMethod == 'get' + +input.setAttribute('formMethod', '5%') +input.getAttribute('formMethod') == '5%' +input.formMethod == 'get' diff --git a/Tests/LibWeb/Text/input/form-formEnctype-attribute.html b/Tests/LibWeb/Text/input/form-formEnctype-attribute.html index 5588b2d0572..87c640d673e 100644 --- a/Tests/LibWeb/Text/input/form-formEnctype-attribute.html +++ b/Tests/LibWeb/Text/input/form-formEnctype-attribute.html @@ -2,6 +2,7 @@ diff --git a/Tests/LibWeb/Text/input/form-formMethod-attribute.html b/Tests/LibWeb/Text/input/form-formMethod-attribute.html index 6d7d214078d..11d6f6e50ce 100644 --- a/Tests/LibWeb/Text/input/form-formMethod-attribute.html +++ b/Tests/LibWeb/Text/input/form-formMethod-attribute.html @@ -2,6 +2,7 @@ diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl index 4b260ba24d0..f4121c0dc7e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl @@ -18,8 +18,8 @@ interface HTMLInputElement : HTMLElement { readonly attribute HTMLFormElement? form; attribute FileList? files; [CEReactions] attribute USVString formAction; - [FIXME, CEReactions] attribute DOMString formEnctype; - [FIXME, CEReactions] attribute DOMString formMethod; + [CEReactions, Reflect=formenctype, Enumerated=FormEnctypeAttribute] attribute DOMString formEnctype; + [CEReactions, Reflect=formmethod, Enumerated=FormMethodAttribute] attribute DOMString formMethod; [CEReactions, Reflect=formnovalidate] attribute boolean formNoValidate; [CEReactions, Reflect=formtarget] attribute DOMString formTarget; [FIXME, CEReactions] attribute unsigned long height;