1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>Runner</title> |
---|
5 | <link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen" /> |
---|
6 | <script src="http://code.jquery.com/jquery-nightly.min.js"></script> |
---|
7 | <script type="text/javascript" src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script> |
---|
8 | <script type="text/javascript"> |
---|
9 | var checkboxState; |
---|
10 | |
---|
11 | $(document).ready(function () { |
---|
12 | |
---|
13 | module(".click() timing bug"); |
---|
14 | test("Inconsistent state reporting between .click() and manual user click of checkbox", function () { |
---|
15 | $('body').append('<input type="checkbox">'); |
---|
16 | $('input:checkbox').click(function () { |
---|
17 | checkboxState = $(this).attr('checked'); |
---|
18 | }); |
---|
19 | |
---|
20 | $('input:checkbox').click(); |
---|
21 | |
---|
22 | ok($('input:checkbox').is(':checked'),"Checkbox is checked"); |
---|
23 | ok(checkboxState === true,"Checkbox reported that it is checked in the .click() handler"); |
---|
24 | |
---|
25 | $('input:checkbox').remove(); |
---|
26 | }); |
---|
27 | }); |
---|
28 | </script> |
---|
29 | </head> |
---|
30 | <body> |
---|
31 | <h1 id="qunit-header">.click() timing bug</h1> |
---|
32 | <h2 id="qunit-banner"></h2> |
---|
33 | <h2 id="qunit-userAgent"></h2> |
---|
34 | <ol id="qunit-tests"></ol> |
---|
35 | |
---|
36 | </body> |
---|
37 | </html> |
---|