@@ -900,49 +900,6 @@ QUnit.test( "mouseenter, mouseleave don't catch exceptions", function( assert )
900
900
}
901
901
} ) ;
902
902
903
- if ( jQuery . fn . click ) {
904
-
905
- QUnit . test ( "trigger() shortcuts" , function ( assert ) {
906
- assert . expect ( 5 ) ;
907
-
908
- var counter , clickCounter ,
909
- elem = jQuery ( "<li><a href='#'>Change location</a></li>" ) . prependTo ( "#firstUL" ) ;
910
- elem . find ( "a" ) . on ( "click" , function ( ) {
911
- var close = jQuery ( "spanx" , this ) ; // same with jQuery(this).find("span");
912
- assert . equal ( close . length , 0 , "Context element does not exist, length must be zero" ) ;
913
- assert . ok ( ! close [ 0 ] , "Context element does not exist, direct access to element must return undefined" ) ;
914
- return false ;
915
- } ) . click ( ) ;
916
-
917
- // manually clean up detached elements
918
- elem . remove ( ) ;
919
-
920
- jQuery ( "#check1" ) . click ( function ( ) {
921
- assert . ok ( true , "click event handler for checkbox gets fired twice, see #815" ) ;
922
- } ) . click ( ) ;
923
-
924
- counter = 0 ;
925
- jQuery ( "#firstp" ) [ 0 ] . onclick = function ( ) {
926
- counter ++ ;
927
- } ;
928
- jQuery ( "#firstp" ) . click ( ) ;
929
- assert . equal ( counter , 1 , "Check that click, triggers onclick event handler also" ) ;
930
-
931
- clickCounter = 0 ;
932
- jQuery ( "#simon1" ) [ 0 ] . onclick = function ( ) {
933
- clickCounter ++ ;
934
- } ;
935
- jQuery ( "#simon1" ) . click ( ) ;
936
- assert . equal ( clickCounter , 1 , "Check that click, triggers onclick event handler on an a tag also" ) ;
937
-
938
- // test that special handlers do not blow up with VML elements (#7071)
939
- jQuery ( "<xml:namespace ns='urn:schemas-microsoft-com:vml' prefix='v' />" ) . appendTo ( "head" ) ;
940
- jQuery ( "<v:oval id='oval' style='width:100pt;height:75pt;' fillcolor='red'> </v:oval>" ) . appendTo ( "#form" ) ;
941
- jQuery ( "#oval" ) . click ( ) . keydown ( ) ;
942
- } ) ;
943
-
944
- }
945
-
946
903
QUnit . test ( "trigger() bubbling" , function ( assert ) {
947
904
assert . expect ( 18 ) ;
948
905
@@ -2778,7 +2735,7 @@ QUnit.test( "preventDefault() on focusin does not throw exception", function( as
2778
2735
"Preventing default on focusin throws no exception" ) ;
2779
2736
2780
2737
done ( ) ;
2781
- } ) . focus ( ) ;
2738
+ } ) . trigger ( "focus" ) ;
2782
2739
} ) ;
2783
2740
2784
2741
QUnit . test ( "Donor event interference" , function ( assert ) {
@@ -2843,6 +2800,46 @@ QUnit.test( "originalEvent property for Chrome, Safari, Fx & Edge of simulated e
2843
2800
jQuery ( "#donor-input" ) . trigger ( "focus" ) ;
2844
2801
} ) ;
2845
2802
2803
+
2804
+ QUnit [ jQuery . fn . click ? "test" : "skip" ] ( "trigger() shortcuts" , function ( assert ) {
2805
+ assert . expect ( 5 ) ;
2806
+
2807
+ var counter , clickCounter ,
2808
+ elem = jQuery ( "<li><a href='#'>Change location</a></li>" ) . prependTo ( "#firstUL" ) ;
2809
+ elem . find ( "a" ) . on ( "click" , function ( ) {
2810
+ var close = jQuery ( "spanx" , this ) ; // same with jQuery(this).find("span");
2811
+ assert . equal ( close . length , 0 , "Context element does not exist, length must be zero" ) ;
2812
+ assert . ok ( ! close [ 0 ] , "Context element does not exist, direct access to element must return undefined" ) ;
2813
+ return false ;
2814
+ } ) . click ( ) ;
2815
+
2816
+ // manually clean up detached elements
2817
+ elem . remove ( ) ;
2818
+
2819
+ jQuery ( "#check1" ) . click ( function ( ) {
2820
+ assert . ok ( true , "click event handler for checkbox gets fired twice, see #815" ) ;
2821
+ } ) . click ( ) ;
2822
+
2823
+ counter = 0 ;
2824
+ jQuery ( "#firstp" ) [ 0 ] . onclick = function ( ) {
2825
+ counter ++ ;
2826
+ } ;
2827
+ jQuery ( "#firstp" ) . click ( ) ;
2828
+ assert . equal ( counter , 1 , "Check that click, triggers onclick event handler also" ) ;
2829
+
2830
+ clickCounter = 0 ;
2831
+ jQuery ( "#simon1" ) [ 0 ] . onclick = function ( ) {
2832
+ clickCounter ++ ;
2833
+ } ;
2834
+ jQuery ( "#simon1" ) . click ( ) ;
2835
+ assert . equal ( clickCounter , 1 , "Check that click, triggers onclick event handler on an a tag also" ) ;
2836
+
2837
+ // test that special handlers do not blow up with VML elements (#7071)
2838
+ jQuery ( "<xml:namespace ns='urn:schemas-microsoft-com:vml' prefix='v' />" ) . appendTo ( "head" ) ;
2839
+ jQuery ( "<v:oval id='oval' style='width:100pt;height:75pt;' fillcolor='red'> </v:oval>" ) . appendTo ( "#form" ) ;
2840
+ jQuery ( "#oval" ) . click ( ) . keydown ( ) ;
2841
+ } ) ;
2842
+
2846
2843
QUnit [ jQuery . fn . click ? "test" : "skip" ] ( "Event aliases" , function ( assert ) {
2847
2844
2848
2845
// Explicitly skipping focus/blur events due to their flakiness
0 commit comments