Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / programmatic-check-no-change-event.html
blobec8544c01cbf914affe28e13210d7c10af60cc5d
1 <html>
2 <head>
3 <title>Untitled</title>
4 <script type="text/javascript">
6 if (window.testRunner)
7 testRunner.dumpAsText();
9 function debug(msg)
11 var span = document.createElement("span");
12 span.innerHTML = msg + '<br>';
13 document.getElementById("console").appendChild(span);
16 var changeEventCount = 0;
18 function main() {
19 var cb = document.getElementById("myCheckbox");
21 // This line should not fire a change event
22 cb.checked = !cb.checked;
24 // This line should fire a change event
25 cb.click();
27 // This line should not fire a change event
28 cb.setAttribute("checked", "checked");
30 if (changeEventCount != 1) {
31 debug("FAIL: expected 1 change event, got " + changeEventCount);
32 } else {
33 debug("PASS: got exactly one change event.");
37 </script>
38 </head>
39 <body onload="main();">
40 <p>This test checks that programmaticly changing the checked state of
41 a checkbox does not fire the "change" event (but user action like
42 calling "click" does).</p>
43 <div id="console"></div>
44 <input type="checkbox" id="myCheckbox" onchange="changeEventCount++">
45 </body>
46 </html>