blob: 868f6964f9cbc8e0a499a9acf107a70e48f851f6 [file] [log] [blame]
<html>
<head>
<script>
var clickcount = 0;
function dispatchClickEvent(target) {
// Create a click event and dispatch it
var event = document.createEvent('UIEvents');
event.initUIEvent('click', true, true, window, 1)
target.dispatchEvent(event);
}
function runTest() {
if (window.testRunner)
testRunner.dumpAsText();
var label1 = document.getElementById('label1');
dispatchClickEvent(label1);
if (clickcount < 1)
return;
var label2 = document.getElementById('label2');
dispatchClickEvent(label2);
if (clickcount < 2)
return;
document.getElementById('result').innerHTML = 'SUCCESS'
}
function inc()
{
clickcount++;
}
</script>
</head>
<body onload="runTest()">
This tests that the correct form control element is clicked when clicking on a label.
If the test is successful, the text "SUCCESS" should show below.<br>
<Label id="label1">label1<button onclick="inc();">inc</button></label><br>
<Label id="label2">label2<fieldset><legend><button onclick="inc();">inc</button></legend></fieldset></label><br>
<div id="result">FAILURE</div>
</body>
</html>