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