From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- .../mediawiki.special.recentchanges.test.js | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js (limited to 'tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js') diff --git a/tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js b/tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js new file mode 100644 index 00000000..d73fe5a6 --- /dev/null +++ b/tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js @@ -0,0 +1,67 @@ +module( 'mediawiki.special.recentchanges', QUnit.newMwEnvironment() ); + +test( '-- Initial check', function() { + expect( 2 ); + ok( mw.special.recentchanges.init, 'mw.special.recentchanges.init defined' ); + ok( mw.special.recentchanges.updateCheckboxes, 'mw.special.recentchanges.updateCheckboxes defined' ); + // TODO: verify checkboxes == [ 'nsassociated', 'nsinvert' ] +}); + +test( '"all" namespace disable checkboxes', function() { + + // from Special:Recentchanges + var select = + '' + + '' + + '' + + '' + + '' + + '' + + '' + ; + + var $env = $( '
' ).html( select ).appendTo( 'body' ); + + // TODO abstract the double strictEquals + + // At first checkboxes are enabled + strictEqual( $( '#nsinvert' ).prop( 'disabled' ), false ); + strictEqual( $( '#nsassociated' ).prop( 'disabled' ), false ); + + // Initiate the recentchanges module + mw.special.recentchanges.init(); + + // By default + strictEqual( $( '#nsinvert' ).prop( 'disabled' ), true ); + strictEqual( $( '#nsassociated' ).prop( 'disabled' ), true ); + + // select second option... + var $options = $( '#namespace' ).find( 'option' ); + $options.eq(0).removeProp( 'selected' ); + $options.eq(1).prop( 'selected', true ); + $( '#namespace' ).change(); + + // ... and checkboxes should be enabled again + strictEqual( $( '#nsinvert' ).prop( 'disabled' ), false ); + strictEqual( $( '#nsassociated' ).prop( 'disabled' ), false ); + + // select first option ( 'all' namespace)... + $options.eq(1).removeProp( 'selected' ); + $options.eq(0).prop( 'selected', true ); + $( '#namespace' ).change(); + + // ... and checkboxes should now be disabled + strictEqual( $( '#nsinvert' ).prop( 'disabled' ), true ); + strictEqual( $( '#nsassociated' ).prop( 'disabled' ), true ); + + // DOM cleanup + $env.remove(); +}); -- cgit v1.2.2