TheDJ has submitted this change and it was merged.
Change subject: jquery.makeCollapsible: Tests for collapse and expand text
......................................................................
jquery.makeCollapsible: Tests for collapse and expand text
Provided via data- attributes (data-collapsetext, data-expandtext)
and via options (options.collapseText, options.expandText).
Change-Id: I8922b80ee9aff149a56c9ca44edc247033fc6d6a
---
M tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js
1 file changed, 37 insertions(+), 0 deletions(-)
Approvals:
TheDJ: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js
b/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js
index 7ae743c..38063e6 100644
--- a/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js
@@ -137,4 +137,41 @@
assert.assertTrue( $content.is( ':hidden' ), 'click event on
non-link inside toggle toggles content' );
} );
+ QUnit.asyncTest( 'collapse/expand text (data-collapsetext,
data-expandtext)', 2, function ( assert ) {
+ var $collapsible, $toggleLink;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible"
data-collapsetext="Collapse me!" data-expandtext="Expand me!">' +
+ loremIpsum +
+ '</div>'
+ );
+ $toggleLink = $collapsible.find( '.mw-collapsible-toggle a' );
+
+ assert.equal( $toggleLink.text(), 'Collapse me!',
'data-collapsetext is respected' );
+
+ $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+ assert.equal( $toggleLink.text(), 'Expand me!',
'data-expandtext is respected' );
+ QUnit.start();
+ } );
+
+ $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click'
);
+ } );
+
+ QUnit.asyncTest( 'collapse/expand text (options.collapseText,
options.expandText)', 2, function ( assert ) {
+ var $collapsible, $toggleLink;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible">' + loremIpsum + '</div>',
+ { collapseText: 'Collapse me!', expandText: 'Expand
me!' }
+ );
+ $toggleLink = $collapsible.find( '.mw-collapsible-toggle a' );
+
+ assert.equal( $toggleLink.text(), 'Collapse me!',
'options.collapseText is respected' );
+
+ $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+ assert.equal( $toggleLink.text(), 'Expand me!',
'options.expandText is respected' );
+ QUnit.start();
+ } );
+
+ $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click'
);
+ } );
+
}( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/74959
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8922b80ee9aff149a56c9ca44edc247033fc6d6a
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits