diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 5674d7bacdc2..396a9899279f 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -216,8 +216,7 @@ _TEST_FILES = \ test_bug555840.html \ test_bug561636.html \ test_bug590363.html \ - test_bug557628-1.html \ - test_bug557628-2.html \ + test_bug557628.html \ test_bug592802.html \ test_bug595429.html \ test_bug595447.html \ diff --git a/content/html/content/test/forms/test_input_attributes_reflection.html b/content/html/content/test/forms/test_input_attributes_reflection.html index efe2a6a5409c..f44d83c17c9c 100644 --- a/content/html/content/test/forms/test_input_attributes_reflection.html +++ b/content/html/content/test/forms/test_input_attributes_reflection.html @@ -20,9 +20,72 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=551670 /** Test for Bug 551670 **/ +// TODO: maybe make those reflections be tested against all input types. + +// .accept +reflectString(document.createElement("input"), "accept", + [ "audio/*", "video/*", "image/*", "image/png", + "application/msword", "appplication/pdf" ]); + // .alt reflectString(document.createElement("input"), "alt"); +// .autocomplete +reflectLimitedEnumerated(document.createElement("input"), "autocomplete", + [ "on", "off" ], [ "", "default", "foo", "tulip" ]); + +// TODO: autofocus (boolean) +// TODO: defaultChecked (boolean) +// TODO: checked (boolean) +// TODO: dirName (not implemented) +// TODO: disabled (boolean) +// TODO: form (HTMLFormElement) +// TODO: files (FileList) +// TODO: formAction (URL) + +// .formEnctype +reflectLimitedEnumerated(document.createElement("input"), "formEnctype", + [ "application/x-www-form-urlencoded", + "multipart/form-data", "text/plain" ], + [ "", "foo", "tulip", "multipart/foo" ], + "application/x-www-form-urlencoded"); + +// .formMethod +reflectLimitedEnumerated(document.createElement("input"), "formMethod", + [ "get", "post" ], [ "", "foo", "tulip" ], "get"); + +// TODO: formNoValidate (boolean) + +// .formTarget +reflectString(document.createElement("input"), "formTarget", + [ "_blank", "_self", "_parent", "_top" ]); + +// TODO: height (non-negative integer) +// TODO: indeterminate (boolean) +// TODO: list (HTMLElement) +// TODO: max (not implemented) +// TODO: maxLength (long) +// TODO: min (not implemented) +// TODO: multiple (boolean) + +// .name +reflectString(document.createElement("input"), "name", + [ "isindex", "_charset_" ]); + +// .pattern +reflectString(document.createElement("input"), "pattern", + [ "[0-9][A-Z]{3}" ]); + +// .placeholder +reflectString(document.createElement("input"), "placeholder", + [ "foo\nbar", "foo\rbar", "foo\r\nbar" ]); + +// TODO: readOnly (boolean) +// TODO: required (boolean) +// TODO: size (unsigned long) +// TODO: src (URL) +// TODO: step (not implemented) + // .type reflectLimitedEnumerated(document.createElement("input"), "type", @@ -34,6 +97,17 @@ reflectLimitedEnumerated(document.createElement("input"), [ "datetime", "date", "month", "week", "time", "datetime-local", "number", "range", "color" ]); +// TODO: defaultValue (reflects @value) +// .value doesn't reflect a content attribute. +// TODO: valueAsDate (not implemented) +// TODO: valueAsNumber (not implemented) +// TODO: selectedOption (not implemented) +// TODO: width (non-negative integer) +// .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/forms/test_pattern_attribute.html b/content/html/content/test/forms/test_pattern_attribute.html index 03f5803cf00c..bdb824ead675 100644 --- a/content/html/content/test/forms/test_pattern_attribute.html +++ b/content/html/content/test/forms/test_pattern_attribute.html @@ -33,34 +33,6 @@ function invalidEventHandler(e) gInvalid = true; } -function checkPatternAttribute(element) -{ - ok('pattern' in element, "Element should have the pattern attribute"); - - is(element.pattern, "tulip", - "pattern IDL attribute value should be 'tulip'"); - is(element.getAttribute('pattern'), "tulip", - "pattern content attribute value should be 'tulip'"); - - element.pattern = "foo"; - is(element.pattern, "foo", - "pattern IDL attribute value should be 'foo'"); - is(element.getAttribute('pattern'), "foo", - "pattern content attribute value should be 'foo'"); - - element.removeAttribute('pattern'); - ok(!element.pattern, - "Element pattern attribute shouldn't be specified"); - is(element.getAttribute('pattern'), null, - "Element pattern attribute shouldn't be specified"); - - element.setAttribute("pattern", "bar"); - is(element.pattern, "bar", - "pattern IDL attribute value should be 'bar'"); - is(element.getAttribute('pattern'), "bar", - "pattern content attribute value should be 'bar'"); -} - function completeValidityCheck(element, alwaysValid, isBarred) { if (element.type == 'file') { @@ -286,9 +258,6 @@ function checkPatternValidity(element) var input = document.getElementById('i'); -// All input types should have the pattern attribute. -checkPatternAttribute(input); - // |validTypes| are the types which accept @pattern // and |invalidTypes| are the ones which do not accept it. var validTypes = Array('text', 'password', 'search', 'tel', 'email', 'url'); diff --git a/content/html/content/test/reflect.js b/content/html/content/test/reflect.js index 6905b6b1cd19..8452b34342aa 100644 --- a/content/html/content/test/reflect.js +++ b/content/html/content/test/reflect.js @@ -1,11 +1,14 @@ /** * Checks that a given attribute is correctly reflected as a string. * - * @param aElement Element node to test - * @param aAttr String name of the attribute + * @param aElement Element node to test + * @param aAttr String name of the attribute + * @param aOtherValues Array other values to test in addition of the default ones [optional] */ -function reflectString(aElement, aAttr) +function reflectString(aElement, aAttr, aOtherValues) { + var otherValues = aOtherValues !== undefined ? aOtherValues : []; + // Tests when the attribute isn't set. is(aElement.getAttribute(aAttr), null, "When not set, the content attribute should be undefined."); @@ -57,6 +60,8 @@ function reflectString(aElement, aAttr) "bar" ] ]; + otherValues.forEach(function(v) { stringsToTest.push([v, v]) }); + stringsToTest.forEach(function([v, r]) { aElement.setAttribute(aAttr, v); is(aElement[aAttr], r, diff --git a/content/html/content/test/test_bug457800.html b/content/html/content/test/test_bug457800.html index b0da1835643e..a6f0f055a430 100644 --- a/content/html/content/test/test_bug457800.html +++ b/content/html/content/test/test_bug457800.html @@ -13,8 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=457800 Mozilla Bug 457800

@@ -51,8 +49,6 @@ function testPlaceholderForElement(element)
   is(element.getAttribute('placeholder'), 'place\rholder', "\\r shouldn't be stripped");
 }
 
-testPlaceholderForElement(document.getElementById('inputtext'));
-testPlaceholderForElement(document.getElementById('inputpassword'));
 testPlaceholderForElement(document.getElementById('textarea'));
 
 
diff --git a/content/html/content/test/test_bug557628-2.html b/content/html/content/test/test_bug557628-2.html
deleted file mode 100644
index 7d82b5f6b8e1..000000000000
--- a/content/html/content/test/test_bug557628-2.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-  Test for Bug 557628
-  
-  
-  
-
-
-Mozilla Bug 557628
-

-
-
-
- - diff --git a/content/html/content/test/test_bug557628-1.html b/content/html/content/test/test_bug557628.html similarity index 100% rename from content/html/content/test/test_bug557628-1.html rename to content/html/content/test/test_bug557628.html diff --git a/content/html/content/test/test_bug566064.html b/content/html/content/test/test_bug566064.html index 6ca5759aad44..3bf274550c97 100644 --- a/content/html/content/test/test_bug566064.html +++ b/content/html/content/test/test_bug566064.html @@ -48,13 +48,10 @@ function checkFormTarget(aElement) isFormTargetEquals(aElement, "", true); } -var input = document.createElement('input'); var button = document.createElement('button'); -ok('formTarget' in input, "formTarget is a HTMLInputElement property"); ok('formTarget' in button, "formTarget is a HTMLButtonElement property"); -checkFormTarget(input); checkFormTarget(button); diff --git a/content/html/content/test/test_bug585508.html b/content/html/content/test/test_bug585508.html index 03e3048e432e..3c0fe67fcb75 100644 --- a/content/html/content/test/test_bug585508.html +++ b/content/html/content/test/test_bug585508.html @@ -63,13 +63,10 @@ function checkAttribute(form, attrName, idlName, data) } var form = document.createElement('form'); -var input = document.createElement('input'); var button = document.createElement('button'); checkAttribute(form, 'enctype', 'enctype', enctypeTestData); checkAttribute(form, 'method', 'method', methodTestData); -checkAttribute(input, 'formenctype', 'formEnctype', enctypeTestData); -checkAttribute(input, 'formmethod', 'formMethod', methodTestData); checkAttribute(button, 'formenctype', 'formEnctype', enctypeTestData); checkAttribute(button, 'formmethod', 'formMethod', methodTestData);