mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 00:25:27 +00:00
Bug 670874 - Tests all attributes in test_textarea_attributes_reflection.html. r=Ms2ger
This commit is contained in:
parent
32f8ab42bd
commit
0fd61ff800
@ -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 \
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -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 = [
|
||||
|
@ -1,52 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=41464
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 41464</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=41464">Mozilla Bug 41464</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<textarea wrap=cheesecake></textarea>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/** Test for Bug 41464 **/
|
||||
var textarea = document.getElementById("content").getElementsByTagName("textarea")[0];
|
||||
is(textarea.wrap, "cheesecake");
|
||||
is(textarea.hasAttribute("wrap"), true);
|
||||
is(textarea.getAttribute("wrap"), "cheesecake");
|
||||
|
||||
textarea.setAttribute("wrap", "off");
|
||||
is(textarea.wrap, "off");
|
||||
is(textarea.hasAttribute("wrap"), true);
|
||||
is(textarea.getAttribute("wrap"), "off");
|
||||
|
||||
textarea.wrap = "soft";
|
||||
is(textarea.wrap, "soft");
|
||||
is(textarea.hasAttribute("wrap"), true);
|
||||
is(textarea.getAttribute("wrap"), "soft");
|
||||
|
||||
textarea.wrap = undefined;
|
||||
is(textarea.wrap, "undefined");
|
||||
is(textarea.hasAttribute("wrap"), true);
|
||||
is(textarea.getAttribute("wrap"), "undefined");
|
||||
|
||||
textarea.wrap = null;
|
||||
is(textarea.wrap, "null");
|
||||
is(textarea.hasAttribute("wrap"), true);
|
||||
is(textarea.getAttribute("wrap"), "null");
|
||||
|
||||
textarea.removeAttribute("wrap");
|
||||
is(textarea.wrap, "");
|
||||
is(textarea.hasAttribute("wrap"), false);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,57 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=457800
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 457800</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=457800">Mozilla Bug 457800</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<textarea id="textarea"></textarea>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 457800 **/
|
||||
|
||||
function testPlaceholderForElement(element)
|
||||
{
|
||||
// init
|
||||
element.value = ''
|
||||
|
||||
// check if {g,s}etAttribute are working
|
||||
element.setAttribute('placeholder', 'placeholder');
|
||||
is(element.getAttribute('placeholder'), 'placeholder', "element has no placeholder attribute");
|
||||
|
||||
// check if placeholder is working through DOM interface
|
||||
is(element.placeholder, 'placeholder', "can't read placeholder in DOM interface");
|
||||
element.placeholder = 'ph';
|
||||
is(element.placeholder, 'ph', "can't write placeholder in DOM interface");
|
||||
|
||||
// check placeholder and value are not interfering
|
||||
is(element.value, '', "value has changed when placeholder has changed");
|
||||
element.value = 'value';
|
||||
is(element.placeholder, 'ph', "placeholder in DOM interface has changed when value has changed");
|
||||
is(element.getAttribute('placeholder'), 'ph', "placeholder attribute has changed when value has changed");
|
||||
|
||||
// check new lines are managed correctly (shouldn't be shown but kept in the DOM)
|
||||
element.placeholder = 'place\nholder';
|
||||
is(element.placeholder, 'place\nholder', "\\n shouldn't be stripped");
|
||||
is(element.getAttribute('placeholder'), 'place\nholder', "\\n shouldn't be stripped");
|
||||
element.placeholder = 'place\rholder';
|
||||
is(element.placeholder, 'place\rholder', "\\r shouldn't be stripped");
|
||||
is(element.getAttribute('placeholder'), 'place\rholder', "\\r shouldn't be stripped");
|
||||
}
|
||||
|
||||
testPlaceholderForElement(document.getElementById('textarea'));
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -13,7 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=546995
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=546995">Mozilla Bug 546995</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<textarea id='t'></textarea>
|
||||
<select id='s'></select>
|
||||
<button id='b'></button>
|
||||
</div>
|
||||
@ -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'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user