blob: 764c98536933dedebd6bb9a29daaf195993167c3 [file] [log] [blame]
<html>
<head>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function log(message)
{
var txt = document.createTextNode(message);
document.getElementById("logger").appendChild(txt);
document.getElementById("logger").appendChild(document.createElement('br'));
}
function logAutoCompleteAPIResult()
{
if (layoutTestController.elementDoesAutoCompleteForElementWithId("autoInput"))
log("Element does autocomplete");
else
log("Element does *not* autocomplete");
}
function runTest()
{
if (!window.layoutTestController) {
alert("This test can only be run in DumpRenderTree");
return;
}
var form = document.getElementById("autoForm");
var input = document.getElementById("autoInput");
// Test with no autocomplete attribute on the <form>
logAutoCompleteAPIResult();
input.setAttribute("autocomplete", "cheese");
logAutoCompleteAPIResult();
input.setAttribute("autocomplete", "off");
logAutoCompleteAPIResult();
input.setAttribute("autocomplete", "on");
logAutoCompleteAPIResult();
input.setAttribute("autocomplete", "cheese");
logAutoCompleteAPIResult();
input.removeAttribute("autocomplete");
logAutoCompleteAPIResult();
// Test with autocomplete="off" on the <form>
form.setAttribute("autocomplete", "off");
logAutoCompleteAPIResult();
input.setAttribute("autocomplete", "cheese");
logAutoCompleteAPIResult();
input.setAttribute("autocomplete", "off");
logAutoCompleteAPIResult();
input.setAttribute("autocomplete", "on");
logAutoCompleteAPIResult();
input.setAttribute("autocomplete", "cheese");
logAutoCompleteAPIResult();
input.removeAttribute("autocomplete");
logAutoCompleteAPIResult();
}
</script>
</head>
<body onload="runTest();">
<div id="logger"></div>
<form id="autoForm" method="post">
<input type="text" id="autoInput"/>
</form>
This test exercises the WebKit API "elementDoesAutoComplete:" to make sure that API clients get the correct answer about whether or not a an element should autocomplete.
</body>
</html>