@@ -6,6 +6,7 @@ var fixture = '\
66 <div class="grandchild"></div>\
77 </div>\
88 </div>\
9+ <input class="input" />\
910 <div class="event-focus" tabindex="-1">\
1011 <div class="event-focus-child" tabindex="-1"></div>\
1112 </div>\
@@ -102,7 +103,7 @@ describe ( 'Events', { beforeEach: getFixtureInit ( fixture ) }, function () {
102103
103104 events . forEach ( function ( event , index ) {
104105
105- it ( `[ ${ event } -> ${ eventsTrigger [ index ] } ]` , function ( t ) {
106+ it ( '[' + event + ' -> ' + eventsTrigger [ index ] + ']' , function ( t ) {
106107
107108 var doc = $ ( document ) ;
108109 var ele = $ ( '.event-focus' ) ;
@@ -183,6 +184,28 @@ describe ( 'Events', { beforeEach: getFixtureInit ( fixture ) }, function () {
183184
184185 } ) ;
185186
187+ ( document . hasFocus ( ) ? it : it . skip ) ( 'listens to native focus/blur' , function ( t ) { // If the document isn't focused the element won't get the focus either
188+
189+ var events = [ 'focus' , 'blur' ] ;
190+
191+ events . forEach ( function ( event ) {
192+
193+ var input = $ ( '.input' ) ;
194+ var count = 0 ;
195+
196+ function handler ( ) {
197+ count ++ ;
198+ }
199+
200+ input . on ( event , handler ) ;
201+ input [ 0 ] [ event ] ( ) ;
202+
203+ t . is ( count , 1 ) ;
204+
205+ } ) ;
206+
207+ } ) ;
208+
186209 it ( 'supports namespaces' , function ( t ) {
187210
188211 var ele = $ ( '.event' ) ;
@@ -737,10 +760,9 @@ describe ( 'Events', { beforeEach: getFixtureInit ( fixture ) }, function () {
737760 nativeHandler . apply ( this , arguments ) ;
738761 } ;
739762
740- ele . on ( event , handler ) ;
741763 ele . trigger ( event ) ;
742764
743- t . is ( count , 2 ) ;
765+ t . is ( count , 1 ) ;
744766
745767 } ) ;
746768
0 commit comments