chromium/third_party/blink/web_tests/fast/events/domactivate-sets-underlying-click-event-as-handled.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 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();
    testRunner.waitUntilDone();
}

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";

function testElement(i) {
    var element = document.forms[0].children[i];

    element.addEventListener("click", function () {
        log("Activated " + this + " type=" + this.type);
    }, false);

    if (!window.eventSender)
        return;

    if (element.type == "text") {
        log("Focusing " + element + " type=" + element.type + " and pressing enter");
        element.focus();
        eventSender.keyDown("Enter");
        return;
    }

    eventSender.mouseMoveTo(element.offsetLeft + element.clientWidth / 2, element.offsetTop + element.clientHeight / 2);
    eventSender.mouseDown();
    eventSender.mouseUp();

    if (element.type == "radio" || element.type == "checkbox")
        return;

    log("Focusing " + element + " type=" + element.type + " and pressing enter");
    element.focus();
    eventSender.keyDown("Enter");
}

function testDetails() {
    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";
        testRunner.notifyDone();
    }
}

document.querySelector("input[type=image]").addEventListener("load", function() {
    i = 0;
    function test() {
        testElement(i);
        i++;
        if (i < document.forms[0].children.length)
            setTimeout(test, 0);
        else
            testDetails();
    }
    test();
});
</script>