Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

TypeError: Cannot call method 'isDefaultPrevented' of undefined #73

Closed
nicoladj77 opened this Issue · 2 comments

2 participants

@nicoladj77

Hi, when i run this test

// check that all submit are disabled
var first_multi = $( 'a.ai1ec-facebook-refresh-multiselect:first' );
var my = spyOnEvent( first_multi, 'click' );
first_multi.click();
expect( 'click' ).toHaveBeenPreventedOn( $( '.ai1ec-facebook-refresh-multiselect:first' ) );

I always get the message "TypeError: Cannot call method 'isDefaultPrevented' of undefined". What am i doing wrong? This is the code i'm trying to test:

$( 'a' ).click( function( e ) {
    e.preventDefault();
    e.stopImmediatePropagation();
} );

I also tried

// Get a button
var $button = $( '#ai1ec_subscribe_users' );
// Call the function
utility_functions.block_all_submit_and_ajax( $button.get(0) );
// check that all submit are disabled
var first_multi = $( '.ai1ec-facebook-refresh-multiselect:first' );
spyOnEvent( '.ai1ec-facebook-refresh-multiselect:first', 'click' );
first_multi.click();
expect( 'click' ).toHaveBeenTriggeredOn( '.ai1ec-facebook-refresh-multiselect:first' );

This gives me back

Expected event click to have been triggered on .ai1ec-facebook-refresh-multiselect:first

@nicoladj77 nicoladj77 closed this
@rbloeth

Nicola, how did you solve this issue? I am currently facing the same problem here...

@nicoladj77

@rbloeth i used waits()

                // Get a button
                var $button = $( '#ai1ec_subscribe_users' );
                // Call the function
                utility_functions.block_all_submit_and_ajax( $button.get(0) );
                waits(20);
                // check that all submit are disabled
                runs( function() {
                    $( '#facebook input[type=submit]' ).each( function( i, el ) {
                        expect( el ).toHaveAttr( 'disabled' );
                    } );
                } );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.