r95571 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95570‎ | r95571 | r95572 >
Date:19:46, 26 August 2011
Author:krinkle
Status:ok
Tags:
Comment:
mediawiki.util.test: Change portlet name to not conflict with core
* 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
Modified paths:
  • /trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js
@@ -144,37 +144,37 @@
145145
146146 var mwPanel = '<div id="mw-panel" class="noprint">\
147147 <h5>Toolbox</h5>\
148 - <div class="portlet" id="p-tb">\
 148+ <div class="portlet" id="p-test-tb">\
149149 <ul class="body"></ul>\
150150 </div>\
151151 </div>',
152 - vectorTabs = '<div id="p-views" class="vectorTabs">\
 152+ vectorTabs = '<div id="p-test-views" class="vectorTabs">\
153153 <h5>Views</h5>\
154154 <ul></ul>\
155155 </div>',
156156 $mwPanel = $(mwPanel).appendTo( 'body' ),
157157 $vectorTabs = $(vectorTabs).appendTo( 'body' );
158158
159 - var tbRL = mw.util.addPortletLink( 'p-tb', 'http://mediawiki.org/wiki/ResourceLoader',
 159+ var tbRL = mw.util.addPortletLink( 'p-test-tb', 'http://mediawiki.org/wiki/ResourceLoader',
160160 'ResourceLoader', 't-rl', 'More info about ResourceLoader on MediaWiki.org ', 'l' );
161161
162162 ok( $.isDomElement( tbRL ), 'addPortletLink returns a valid DOM Element according to $.isDomElement' );
163163
164 - var tbMW = mw.util.addPortletLink( 'p-tb', 'http://mediawiki.org/',
 164+ var tbMW = mw.util.addPortletLink( 'p-test-tb', 'http://mediawiki.org/',
165165 'MediaWiki.org', 't-mworg', 'Go to MediaWiki.org ', 'm', tbRL ),
166166 $tbMW = $( tbMW );
167167
168168
169169 equal( $tbMW.attr( 'id' ), 't-mworg', 'Link has correct ID set' );
170 - equal( $tbMW.closest( '.portlet' ).attr( 'id' ), 'p-tb', 'Link was inserted within correct portlet' );
 170+ equal( $tbMW.closest( '.portlet' ).attr( 'id' ), 'p-test-tb', 'Link was inserted within correct portlet' );
171171 equal( $tbMW.next().attr( 'id' ), 't-rl', 'Link is in the correct position (by passing nextnode)' );
172172
173 - var tbRLDM = mw.util.addPortletLink( 'p-tb', 'http://mediawiki.org/wiki/RL/DM',
 173+ var tbRLDM = mw.util.addPortletLink( 'p-test-tb', 'http://mediawiki.org/wiki/RL/DM',
174174 'Default modules', 't-rldm', 'List of all default modules ', 'd', '#t-rl' );
175175
176176 equal( $( tbRLDM ).next().attr( 'id' ), 't-rl', 'Link is in the correct position (by passing CSS selector)' );
177177
178 - var caFoo = mw.util.addPortletLink( 'p-views', '#', 'Foo' );
 178+ var caFoo = mw.util.addPortletLink( 'p-test-views', '#', 'Foo' );
179179
180180 strictEqual( $tbMW.find( 'span').length, 0, 'No <span> element should be added for porlets without vectorTabs class.' );
181181 strictEqual( $( caFoo ).find( 'span').length, 1, 'A <span> element should be added for porlets with vectorTabs class.' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r100042add useful comments about portlet ids...hashar15:57, 17 October 2011

Status & tagging log