Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encodi...
[WebKit-https.git] / LayoutTests / fast / events / programmatic-check-no-change-event.html
1 <html>
2 <head>
3         <title>Untitled</title>
4         <script type="text/javascript">
5
6 if (window.testRunner)
7     testRunner.dumpAsText();
8         
9 function debug(msg)
10 {
11     var span = document.createElement("span");
12     span.innerHTML = msg + '<br>';
13     document.getElementById("console").appendChild(span);
14 }
15
16 var changeEventCount = 0;
17
18                 function main() {
19                         var cb = document.getElementById("myCheckbox");
20                         
21                         // This line should not fire a change event
22                         cb.checked = !cb.checked;
23                         
24                         // This line should fire a change event
25                         cb.click();
26                         
27                         // This line should not fire a change event
28                         cb.setAttribute("checked", "checked");
29
30                         if (changeEventCount != 1) {
31                             debug("FAIL: expected 1 change event, got " + changeEventCount); 
32                         } else {
33                             debug("PASS: got exactly one change event.");
34                         }
35                 }
36         
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>