MarkTraceur has uploaded a new change for review. https://gerrit.wikimedia.org/r/111225
Change subject: Fix categories empty method ...................................................................... Fix categories empty method +test Change-Id: I16f19dde713709b0cf8631cb1bf0ceee6ca438a7 --- M resources/mmv/ui/mmv.ui.categories.js M tests/qunit/mmv.ui.categories.test.js 2 files changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer refs/changes/25/111225/1 diff --git a/resources/mmv/ui/mmv.ui.categories.js b/resources/mmv/ui/mmv.ui.categories.js index c230bdc..c3faf40 100755 --- a/resources/mmv/ui/mmv.ui.categories.js +++ b/resources/mmv/ui/mmv.ui.categories.js @@ -82,6 +82,7 @@ Categories.prototype.empty = function () { if ( this.$categories ) { this.$categories.remove(); + this.$categories = undefined; } }; diff --git a/tests/qunit/mmv.ui.categories.test.js b/tests/qunit/mmv.ui.categories.test.js index b1c7a91..443b0f9 100755 --- a/tests/qunit/mmv.ui.categories.test.js +++ b/tests/qunit/mmv.ui.categories.test.js @@ -40,14 +40,15 @@ assert.ok( $( '.mw-mlb-image-category > span' ).eq( 3 ).hasClass( 'extra' ), 'Categories after the third are marked as extra' ); } ); - QUnit.test( 'Emptying data works as expected', 3, function ( assert ) { + QUnit.test( 'Emptying data works as expected', 4, function ( assert ) { var $list = $( '<ul>' ).appendTo( $( '#qunit-fixture' ) ), categories = new mw.mmv.ui.Categories( $list ); categories.set( 'http://example.net/wiki/$1', [ 'Foo', 'Bar', 'Baz', 'Quux' ] ); categories.empty(); - assert.strictEqual( $( '.mw-mlb-image-category > span' ).length, 0, 'All elements are removed from the object' ); + assert.strictEqual( $( '.mw-mlb-image-category > span' ).length, 0, 'All elements are removed from the DOM' ); assert.strictEqual( $list.text(), '', 'Text is emptied correctly' ); assert.strictEqual( $list.find( 'li' ).length, 0, 'List elements are all removed' ); + assert.strictEqual( categories.$categories, undefined, 'Category UI element is removed from object' ); } ); }( mediaWiki, jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/111225 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I16f19dde713709b0cf8631cb1bf0ceee6ca438a7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MultimediaViewer Gerrit-Branch: master Gerrit-Owner: MarkTraceur <mtrac...@member.fsf.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits