var $collapsible = prepareCollapsible(
'<div class="mw-collapsible">' +
'<div class="mw-collapsible-toggle">' +
- 'Toggle <a href="#">toggle</a> toggle <b>toggle</b>' +
+ 'Toggle <a href="#top">toggle</a> toggle <b>toggle</b>' +
'</div>' +
'<div class="mw-collapsible-content">' + loremIpsum + '</div>' +
'</div>',
assert.assertTrue( $content.is( ':hidden' ), 'click event on non-link inside toggle toggles content' );
} );
+ QUnit.test( 'click on non-link inside toggler counts as trigger', function ( assert ) {
+ var $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible">' +
+ '<div class="mw-collapsible-toggle">' +
+ 'Toggle <a>toggle</a> toggle <b>toggle</b>' +
+ '</div>' +
+ '<div class="mw-collapsible-content">' + loremIpsum + '</div>' +
+ '</div>',
+ { instantHide: true }
+ ),
+ $content = $collapsible.find( '.mw-collapsible-content' );
+
+ $collapsible.find( '.mw-collapsible-toggle a' ).trigger( 'click' );
+ assert.assertTrue( $content.is( ':hidden' ), 'click event on link (with no href) inside toggle toggles content' );
+ } );
+
QUnit.test( 'collapse/expand text (data-collapsetext, data-expandtext)', function ( assert ) {
var $collapsible = prepareCollapsible(
'<div class="mw-collapsible" data-collapsetext="Collapse me!" data-expandtext="Expand me!">' +