73 lines
2.2 KiB
HTML
73 lines
2.2 KiB
HTML
<!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 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";
|
|
|
|
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("\n");
|
|
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("\n");
|
|
}
|
|
|
|
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>
|