From b40c8758f7c9bd21732ed7931f59b793baa5d8e6 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Thu, 21 Jul 2011 09:36:09 -0700 Subject: [PATCH] Bug 670874 - Tests all attributes in test_textarea_attributes_reflection.html. r=Ms2ger --- content/html/content/test/Makefile.in | 2 - .../test/forms/test_required_attribute.html | 26 ------- .../test_textarea_attributes_reflection.html | 77 +++++++++++++++++-- content/html/content/test/reflect.js | 18 +++-- content/html/content/test/test_bug41464.html | 52 ------------- content/html/content/test/test_bug457800.html | 57 -------------- content/html/content/test/test_bug546995.html | 2 - 7 files changed, 82 insertions(+), 152 deletions(-) delete mode 100644 content/html/content/test/test_bug41464.html delete mode 100644 content/html/content/test/test_bug457800.html diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 915fa3a9092c..296c6302e218 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -72,7 +72,6 @@ _TEST_FILES = \ test_bug3348.html \ test_bug6296.html \ test_bug24958.html \ - test_bug41464.html \ bug100533_load.html \ bug100533_iframe.html \ test_bug100533.html \ @@ -179,7 +178,6 @@ _TEST_FILES = \ test_bug529859.html \ test_bug535043.html \ test_bug547850.html \ - test_bug457800.html \ test_bug536891.html \ test_bug536895.html \ test_bug458037.xhtml \ diff --git a/content/html/content/test/forms/test_required_attribute.html b/content/html/content/test/forms/test_required_attribute.html index f9621424efc2..bc432db105f6 100644 --- a/content/html/content/test/forms/test_required_attribute.html +++ b/content/html/content/test/forms/test_required_attribute.html @@ -26,31 +26,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=345822 /** Test for Bug 345822 **/ -function checkRequiredAttribute(element) -{ - ok('required' in element, "Element should have the required attribute"); - - ok(!element.required, "Element required attribute should be disabled"); - is(element.getAttribute('required'), null, - "Element required attribute should be disabled"); - - element.required = true; - ok(element.required, "Element required attribute should be enabled"); - isnot(element.getAttribute('required'), null, - "Element required attribute should be enabled"); - - element.removeAttribute('required'); - element.setAttribute('required', ''); - ok(element.required, "Element required attribute should be enabled"); - isnot(element.getAttribute('required'), null, - "Element required attribute should be enabled"); - - element.removeAttribute('required'); - ok(!element.required, "Element required attribute should be disabled"); - is(element.getAttribute('required'), null, - "Element required attribute should be disabled"); -} - function checkNotSufferingFromBeingMissing(element, doNotApply) { ok(!element.validity.valueMissing, @@ -324,7 +299,6 @@ function checkInputRequiredValidityForFile() document.forms[0].removeChild(element); } -checkRequiredAttribute(document.createElement('textarea')); checkTextareaRequiredValidity(); // The require attribute behavior depend of the input type. diff --git a/content/html/content/test/forms/test_textarea_attributes_reflection.html b/content/html/content/test/forms/test_textarea_attributes_reflection.html index c57f2234cd2e..1296ca285f81 100644 --- a/content/html/content/test/forms/test_textarea_attributes_reflection.html +++ b/content/html/content/test/forms/test_textarea_attributes_reflection.html @@ -14,22 +14,83 @@ /** Test for HTMLTextAreaElement attributes reflection **/ -var textarea = document.createElement("textarea"); - -reflectUnsignedInt({ - element: textarea, - attribute: "rows", - nonZero: true, - defaultValue: 2, +// .autofocus +reflectBoolean({ + element: document.createElement("textarea"), + attribute: "autofocus", }); +//.cols reflectUnsignedInt({ - element: textarea, + element: document.createElement("textarea"), attribute: "cols", nonZero: true, defaultValue: 20, }); +todo("dirName" in document.createElement("textarea"), + "dirName isn't implemented yet"); + +// .disabled +reflectBoolean({ + element: document.createElement("textarea"), + attribute: "disabled", +}); + +// TODO: form (HTMLFormElement) +// TODO: maxLength (long) + +// .name +reflectString({ + element: document.createElement("textarea"), + attribute: "name", + otherValues: [ "isindex", "_charset_" ], +}); + +// .placeholder +reflectString({ + element: document.createElement("textarea"), + attribute: "placeholder", + otherValues: [ "foo\nbar", "foo\rbar", "foo\r\nbar" ], +}); + +// .readOnly +reflectBoolean({ + element: document.createElement("textarea"), + attribute: "readOnly", +}); + +// .required +reflectBoolean({ + element: document.createElement("textarea"), + attribute: "required", +}); + +// .rows +reflectUnsignedInt({ + element: document.createElement("textarea"), + attribute: "rows", + nonZero: true, + defaultValue: 2, +}); + +// .wrap +// TODO: make it an enumerated attributes limited to only known values, bug 670869. +reflectString({ + element: document.createElement("textarea"), + attribute: "wrap", + otherValues: [ "soft", "hard" ], +}); + +// .type doesn't reflect a content attribute. +// .defaultValue doesn't reflect a content attribute. +// .value doesn't reflect a content attribute. +// .textLength doesn't reflect a content attribute. +// .willValidate doesn't reflect a content attribute. +// .validity doesn't reflect a content attribute. +// .validationMessage doesn't reflect a content attribute. +// .labels doesn't reflect a content attribute. + diff --git a/content/html/content/test/reflect.js b/content/html/content/test/reflect.js index 2ca84f8bf3ea..c7139c8f57fb 100644 --- a/content/html/content/test/reflect.js +++ b/content/html/content/test/reflect.js @@ -55,11 +55,19 @@ function reflectString(aParameters) element.removeAttribute(contentAttr); element[idlAttr] = null; - todo_is(element.getAttribute(contentAttr), "null", - "null should have been stringified to 'null'"); - todo_is(element[idlAttr], "null", - "null should have been stringified to 'null'"); - element.removeAttribute(contentAttr); + // TODO: remove this ugly hack when null stringification will work as expected. + if (element.localName == "textarea" && idlAttr == "wrap") { + is(element.getAttribute(contentAttr), "null", + "null should have been stringified to 'null'"); + is(element[idlAttr], "null", "null should have been stringified to 'null'"); + element.removeAttribute(contentAttr); + } else { + todo_is(element.getAttribute(contentAttr), "null", + "null should have been stringified to 'null'"); + todo_is(element[idlAttr], "null", + "null should have been stringified to 'null'"); + element.removeAttribute(contentAttr); + } // Tests various strings. var stringsToTest = [ diff --git a/content/html/content/test/test_bug41464.html b/content/html/content/test/test_bug41464.html deleted file mode 100644 index d417f2675e7b..000000000000 --- a/content/html/content/test/test_bug41464.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Test for Bug 41464 - - - - - -Mozilla Bug 41464 -

- -
-
-
- - diff --git a/content/html/content/test/test_bug457800.html b/content/html/content/test/test_bug457800.html deleted file mode 100644 index a6f0f055a430..000000000000 --- a/content/html/content/test/test_bug457800.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Test for Bug 457800 - - - - - -Mozilla Bug 457800 -

- -
-
-
- - diff --git a/content/html/content/test/test_bug546995.html b/content/html/content/test/test_bug546995.html index 399c5b521865..65386c2bde6a 100644 --- a/content/html/content/test/test_bug546995.html +++ b/content/html/content/test/test_bug546995.html @@ -13,7 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=546995 Mozilla Bug 546995

@@ -35,7 +34,6 @@ function checkAutofocusIDLAttribute(element) } // TODO: keygen should be added when correctly implemented, see bug 101019. -checkAutofocusIDLAttribute(document.getElementById('t')); checkAutofocusIDLAttribute(document.getElementById('s')); checkAutofocusIDLAttribute(document.getElementById('b'));