]> source.dussan.org Git - jquery-ui.git/commitdiff
Core tests: Split .focus() test into two tests to avoid bug in IE with stop() and...
authorScott González <scott.gonzalez@gmail.com>
Thu, 2 Sep 2010 15:14:00 +0000 (11:14 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 2 Sep 2010 15:14:00 +0000 (11:14 -0400)
tests/unit/core/core.js

index cb2a145709f6c8d42d6d01cf3c637e51e86b929e..03a7ab81021ad3278110de920f768b06a2f809c1 100644 (file)
@@ -5,27 +5,27 @@
 
 module('core - jQuery extensions');
 
-test('focus', function() {
-       expect(3);
+test('focus - original functionality', function() {
+       expect(1);
        
-       var el = $('#inputTabindex0'),
-               // used to remove focus from the main element
-               other = $('#inputTabindex10');
-       
-       // test original functionality
-       el.focus(function() {
-               ok(true, 'event triggered');
-       });
-       el.focus();
-       other.focus();
-       
-       // trigger event handler + callback
-       stop();
-       el.focus(500, function() {
-               ok(true, 'callback triggered');
-               start();
-       });
-       other.focus();
+       $('#inputTabindex0')
+               .focus(function() {
+                       ok(true, 'event triggered');
+               })
+               .focus();
+});
+
+asyncTest('focus', function() {
+       expect(2);
+       $('#inputTabindex0')
+               .focus(function() {
+                       ok(true, 'event triggered');
+               })
+               .focus(500, function() {
+                       ok(true, 'callback triggered');
+                       $(this).unbind('focus');
+                       start();
+               });
 });
 
 test('zIndex', function() {