2 QUnit
.module( 'mediawiki.toc', QUnit
.newMwEnvironment() );
4 QUnit
.asyncTest( 'toggleToc', 4, function ( assert
) {
5 var tocHtml
, $toggleLink
, $tocList
;
12 assert
.strictEqual( $tocList
.is( ':hidden' ), true, 'Return boolean true if the TOC is now visible.' );
14 $tocList
.promise().done( actionC
);
18 assert
.strictEqual( $tocList
.is( ':hidden' ), false, 'Return boolean false if the TOC is now hidden.' );
20 $tocList
.promise().done( actionB
);
23 assert
.strictEqual( $( '#toc' ).length
, 0, 'Return 0 if there is no table of contents on the page.' );
25 tocHtml
= '<div id="toc" class="toc">' +
26 '<div id="toctitle">' +
29 '<ul><li></li></ul>' +
31 $( tocHtml
).appendTo( '#qunit-fixture' );
32 mw
.hook( 'wikipage.content' ).fire( $( '#qunit-fixture' ) );
33 $tocList
= $( '#toc ul:first' );
34 $toggleLink
= $( '#togglelink' );
36 assert
.strictEqual( $toggleLink
.length
, 1, 'Toggle link is appended to the page.' );
40 }( mediaWiki
, jQuery
) );