Jquery: Create Unit test for toggle/show/hide( callback )

Created on 21 Oct 2014  路  6Comments  路  Source: jquery/jquery

Originally reported by gnarf at: http://bugs.jquery.com/ticket/12821

This signature should result in an animated toggle/show/hide with the default duration. This has historically been the behavior, and we should test it and document it. See also  https://github.com/jquery/api.jquery.com/issues/167.

The signature should also hold true for fade* and slide*

Issue reported for jQuery 1.8.2

Effects help wanted

All 6 comments

Rescheduling to 3.0.1.

Can I work on the issue?

I am pretty sure no one else is! Feel free!

@gnarf can you help me a little about what needs to be done? I can see that here it was reported that callback also results in animation. So should I be adding that in the documentation and creating unit tests for that check?

The documentation does exist for it, because duration is optional in the signature, but it should be unit tested that when you call .toggle(fn) .show(fn) or .hide(fn) it results in a default duration animation.

Something along the lines of calling jQuery( ".some-hidden-element" ).toggle( function( p ) { callbackCalled = true; } ) then checking that callbackCalled isn't called, perhaps checking the state of the element is correct for a show/hide animation in it's first frame, then this.clock.tick(400) and check that callbackCalled and last frame.

This should probably be sufficient

@gnarf ok thanks. I will look into it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

korenevskiy picture korenevskiy  路  7Comments

jonathanKingston picture jonathanKingston  路  6Comments

gibson042 picture gibson042  路  9Comments

otengkwame picture otengkwame  路  3Comments

DevelopOnline picture DevelopOnline  路  3Comments