<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<details id="d">
<summary>
  <input type="button" value="button" id="buttonControl">
  <input type="text" value="text" id="textControl">
  <textarea value="textarea" id="textareaControl"></textarea>
  <div id="block">This is clickable summary text</div>
</summary>
This is a detail.
</details>
<script>
function clickOn(id)
{
    var control = document.getElementById(id);
    var x = control.offsetLeft;
    var y = control.offsetTop;
    var delta = 5;
    eventSender.mouseMoveTo(x + delta, y + delta);
    eventSender.mouseDown();
    eventSender.mouseUp();
}

if (window.eventSender) {
    details = document.getElementById("d");
    shouldBeFalse("details.open");
    clickOn("buttonControl");
    shouldBeFalse("details.open");
    clickOn("textControl");
    shouldBeFalse("details.open");
    clickOn("textareaControl");
    shouldBeFalse("details.open");
    clickOn("block");
    shouldBeTrue("details.open");
    details.style.display = "none";
}


</script>
</body>
</html>
