// Hide/show the table of contents element
function toggleToc() {
- if ( $tocList.is( ':hidden' ) ) {
+ if ( $this.hasClass( 'tochidden' ) ) {
// FIXME: Use CSS transitions
// eslint-disable-next-line no-jquery/no-slide
$tocList.slideDown( 'fast' );
$( '#qunit-fixture' ).append( $toc );
mw.hook( 'wikipage.content' ).fire( $( '#qunit-fixture' ) );
- $tocList = $toc.find( 'ul:first' );
+ $tocList = $toc.find( 'ul' ).first();
$toggleLink = $toc.find( '.togglelink' );
assert.strictEqual( $toggleLink.length, 1, 'Toggle link is added to the table of contents' );
- assert.strictEqual( $tocList.is( ':hidden' ), false, 'The table of contents is now visible' );
+ assert.strictEqual( $toc.hasClass( 'tochidden' ), false, 'The table of contents is now visible' );
$toggleLink.trigger( 'click' );
return $tocList.promise().then( function () {
- assert.strictEqual( $tocList.is( ':hidden' ), true, 'The table of contents is now hidden' );
-
+ assert.strictEqual( $toc.hasClass( 'tochidden' ), true, 'The table of contents is now hidden' );
$toggleLink.trigger( 'click' );
return $tocList.promise();
} );