2011-01-20 03:06:34 -08:00
|
|
|
function check(aElementName, aBarred) {
|
2010-08-26 22:46:17 -07:00
|
|
|
let doc = gBrowser.contentDocument;
|
|
|
|
let tooltip = document.getElementById("aHTMLTooltip");
|
|
|
|
let content = doc.getElementById('content');
|
|
|
|
|
|
|
|
let e = doc.createElement(aElementName);
|
|
|
|
content.appendChild(e);
|
|
|
|
|
|
|
|
ok(!FillInHTMLTooltip(e),
|
|
|
|
"No tooltip should be shown when the element is valid");
|
|
|
|
|
|
|
|
e.setCustomValidity('foo');
|
|
|
|
if (aBarred) {
|
|
|
|
ok(!FillInHTMLTooltip(e),
|
|
|
|
"No tooltip should be shown when the element is barred from constraint validation");
|
|
|
|
} else {
|
|
|
|
ok(FillInHTMLTooltip(e),
|
2011-01-20 03:06:34 -08:00
|
|
|
e.tagName + " " +"A tooltip should be shown when the element isn't valid");
|
2010-08-26 22:46:17 -07:00
|
|
|
}
|
|
|
|
|
2010-11-15 14:56:01 -08:00
|
|
|
e.setAttribute('title', '');
|
|
|
|
ok (!FillInHTMLTooltip(e),
|
|
|
|
"No tooltip should be shown if the title attribute is set");
|
|
|
|
|
2010-12-17 09:47:30 -08:00
|
|
|
e.removeAttribute('title');
|
|
|
|
content.setAttribute('novalidate', '');
|
|
|
|
ok (!FillInHTMLTooltip(e),
|
|
|
|
"No tooltip should be shown if the novalidate attribute is set on the form owner");
|
|
|
|
content.removeAttribute('novalidate');
|
|
|
|
|
2010-08-26 22:46:17 -07:00
|
|
|
content.removeChild(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
function todo_check(aElementName, aBarred) {
|
|
|
|
let doc = gBrowser.contentDocument;
|
|
|
|
let tooltip = document.getElementById("aHTMLTooltip");
|
|
|
|
let content = doc.getElementById('content');
|
|
|
|
|
|
|
|
let e = doc.createElement(aElementName);
|
|
|
|
content.appendChild(e);
|
|
|
|
|
|
|
|
let cought = false;
|
|
|
|
try {
|
|
|
|
e.setCustomValidity('foo');
|
|
|
|
} catch (e) {
|
|
|
|
cought = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
todo(!cought, "setCustomValidity should exist for " + aElementName);
|
|
|
|
|
|
|
|
content.removeChild(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test () {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
gBrowser.selectedBrowser.addEventListener("load", function () {
|
|
|
|
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
|
|
|
|
|
|
let testData = [
|
2011-01-20 03:06:34 -08:00
|
|
|
/* element name, barred */
|
|
|
|
[ 'input', false ],
|
|
|
|
[ 'textarea', false ],
|
|
|
|
[ 'button', true ],
|
|
|
|
[ 'select', false ],
|
|
|
|
[ 'output', true ],
|
|
|
|
[ 'fieldset', true ],
|
|
|
|
[ 'object', true ],
|
2010-08-26 22:46:17 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
for each (let data in testData) {
|
2011-01-20 03:06:34 -08:00
|
|
|
check(data[0], data[1]);
|
2010-08-26 22:46:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
let todo_testData = [
|
|
|
|
[ 'keygen', 'false' ],
|
|
|
|
];
|
|
|
|
|
|
|
|
for each(let data in todo_testData) {
|
|
|
|
todo_check(data[0], data[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
finish();
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
content.location =
|
2010-12-17 09:47:30 -08:00
|
|
|
"data:text/html,<!DOCTYPE html><html><body><form id='content'></form></body></html>";
|
2010-08-26 22:46:17 -07:00
|
|
|
}
|
|
|
|
|