blob: ae7404eb31d73298c4d578e81fa64c2f6dd90c57 [file] [log] [blame]
<!DOCTYPE html>
To test manually, click on all the form elements (except the textbox) and the details/summary
element. The anchor shouldn't be activated (i.e. you shouldn't see any "anchor activated" messages).
<a href="javascript:anchorActivated()">
<form action="javascript:formSubmitted()">
<input type=text>
<input type=submit>
<input src="resources/abe.png" type=image>
<button>button</button>
<input type=reset>
<button type=reset>button reset</button>
<input type=checkbox>
<input type=radio>
<input type=file>
</form>
<details><summary>summary</summary>details</details>
</a>
<pre>
</pre>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function log(message) { document.querySelector("pre").innerHTML += message + "\n"; }
function formSubmitted() { log("form submitted\n"); }
function anchorActivated() { log("anchor activated\n"); }
document.forms[0].children[0].value = "blah";
document.querySelector("input[type=image]").addEventListener("load", function() {
for (var i=0; i < document.forms[0].children.length; i++) {
var element = document.forms[0].children[i];
element.addEventListener("click", function () {
log("Activated " + this + " type=" + this.type);
}, false);
if (!window.eventSender)
continue;
if (element.type == "text") {
log("Focusing " + element + " type=" + element.type + " and pressing enter");
element.focus();
eventSender.keyDown("Enter");
continue;
}
eventSender.mouseMoveTo(element.offsetLeft + element.clientWidth / 2, element.offsetTop + element.clientHeight / 2);
eventSender.mouseDown();
eventSender.mouseUp();
if (element.type == "radio" || element.type == "checkbox")
continue;
log("Focusing " + element + " type=" + element.type + " and pressing enter");
element.focus();
eventSender.keyDown("Enter");
}
if (window.eventSender) {
var details = document.querySelector("details");
eventSender.mouseMoveTo(details.offsetLeft + details.clientWidth / 2, details.offsetTop + details.clientHeight / 2);
eventSender.mouseDown();
eventSender.mouseUp();
log("\nThe details element was " + (details.open ? "" : "not ") + "opened");
}
if (window.testRunner)
document.querySelector("a").style.display = "none";
});
</script>