Revision control

1
<html>
2
<head>
3
<script>
4
5
if (window.testRunner)
6
testRunner.dumpAsText();
7
8
function log(message)
9
{
10
var txt = document.createTextNode(message);
11
document.getElementById("logger").appendChild(txt);
12
document.getElementById("logger").appendChild(document.createElement('br'));
13
}
14
15
function logAutoCompleteAPIResult(input)
16
{
17
if (internals.elementShouldAutoComplete(input))
18
log("Element does autocomplete");
19
else
20
log("Element does *not* autocomplete");
21
}
22
23
function runTest()
24
{
25
if (!window.testRunner) {
26
alert("This test can only be run in DumpRenderTree");
27
return;
28
}
29
30
var form = document.getElementById("autoForm");
31
var input = document.getElementById("autoInput");
32
33
// Test with no autocomplete attribute on the <form>
34
logAutoCompleteAPIResult(input);
35
36
input.setAttribute("autocomplete", "cheese");
37
logAutoCompleteAPIResult(input);
38
39
input.setAttribute("autocomplete", "off");
40
logAutoCompleteAPIResult(input);
41
42
input.setAttribute("autocomplete", "on");
43
logAutoCompleteAPIResult(input);
44
45
input.setAttribute("autocomplete", "cheese");
46
logAutoCompleteAPIResult(input);
47
48
input.removeAttribute("autocomplete");
49
logAutoCompleteAPIResult(input);
50
51
// Test with autocomplete="off" on the <form>
52
form.setAttribute("autocomplete", "off");
53
logAutoCompleteAPIResult(input);
54
55
input.setAttribute("autocomplete", "cheese");
56
logAutoCompleteAPIResult(input);
57
58
input.setAttribute("autocomplete", "off");
59
logAutoCompleteAPIResult(input);
60
61
input.setAttribute("autocomplete", "on");
62
logAutoCompleteAPIResult(input);
63
64
input.setAttribute("autocomplete", "cheese");
65
logAutoCompleteAPIResult(input);
66
67
input.removeAttribute("autocomplete");
68
logAutoCompleteAPIResult(input);
69
}
70
71
</script>
72
</head>
73
<body onload="runTest();">
74
<div id="logger"></div>
75
<form id="autoForm" method="post">
76
<input type="text" id="autoInput"/>
77
</form>
78
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.
79
</body>
80
</html>