mediawiki.util.test: Change portlet name to not conflict with core
authorKrinkle <krinkle@users.mediawiki.org>
Fri, 26 Aug 2011 19:46:31 +0000 (19:46 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Fri, 26 Aug 2011 19:46:31 +0000 (19:46 +0000)
* When running the tests inside a wiki page, the added portletlinks are invisible to the selector since only 1 element can have the same id.s

tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js

index f51705d..83fabf8 100644 (file)
@@ -144,37 +144,37 @@ test( 'addPortletLink', function() {
 
        var mwPanel = '<div id="mw-panel" class="noprint">\
        <h5>Toolbox</h5>\
-       <div class="portlet" id="p-tb">\
+       <div class="portlet" id="p-test-tb">\
                <ul class="body"></ul>\
        </div>\
 </div>',
-       vectorTabs = '<div id="p-views" class="vectorTabs">\
+       vectorTabs = '<div id="p-test-views" class="vectorTabs">\
        <h5>Views</h5>\
        <ul></ul>\
 </div>',
        $mwPanel = $(mwPanel).appendTo( 'body' ),
        $vectorTabs = $(vectorTabs).appendTo( 'body' );
 
-       var tbRL = mw.util.addPortletLink( 'p-tb', 'http://mediawiki.org/wiki/ResourceLoader',
+       var tbRL = mw.util.addPortletLink( 'p-test-tb', 'http://mediawiki.org/wiki/ResourceLoader',
                'ResourceLoader', 't-rl', 'More info about ResourceLoader on MediaWiki.org ', 'l' );
 
        ok( $.isDomElement( tbRL ), 'addPortletLink returns a valid DOM Element according to $.isDomElement' );
 
-       var     tbMW = mw.util.addPortletLink( 'p-tb', 'http://mediawiki.org/',
+       var     tbMW = mw.util.addPortletLink( 'p-test-tb', 'http://mediawiki.org/',
                        'MediaWiki.org', 't-mworg', 'Go to MediaWiki.org ', 'm', tbRL ),
                $tbMW = $( tbMW );
 
 
        equal( $tbMW.attr( 'id' ), 't-mworg', 'Link has correct ID set' );
-       equal( $tbMW.closest( '.portlet' ).attr( 'id' ), 'p-tb', 'Link was inserted within correct portlet' );
+       equal( $tbMW.closest( '.portlet' ).attr( 'id' ), 'p-test-tb', 'Link was inserted within correct portlet' );
        equal( $tbMW.next().attr( 'id' ), 't-rl', 'Link is in the correct position (by passing nextnode)' );
 
-       var tbRLDM = mw.util.addPortletLink( 'p-tb', 'http://mediawiki.org/wiki/RL/DM',
+       var tbRLDM = mw.util.addPortletLink( 'p-test-tb', 'http://mediawiki.org/wiki/RL/DM',
                'Default modules', 't-rldm', 'List of all default modules ', 'd', '#t-rl' );
 
        equal( $( tbRLDM ).next().attr( 'id' ), 't-rl', 'Link is in the correct position (by passing CSS selector)' );
 
-       var caFoo = mw.util.addPortletLink( 'p-views', '#', 'Foo' );
+       var caFoo = mw.util.addPortletLink( 'p-test-views', '#', 'Foo' );
 
        strictEqual( $tbMW.find( 'span').length, 0, 'No <span> element should be added for porlets without vectorTabs class.' );
        strictEqual( $( caFoo ).find( 'span').length, 1, 'A <span> element should be added for porlets with vectorTabs class.' );