Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.test.js |
— | — | @@ -52,7 +52,11 @@ |
53 | 53 | } |
54 | 54 | var escapedtitle = mw.html.escape( title ).replace( / /g, ' ' ); |
55 | 55 | this.addedTests.push( [ 'HEADER', escapedtitle, mw.test.numberOfHeader++ ] ); |
56 | | - this.$table.append( '<tr class="mw-mwutiltest-head" id="mw-mwutiltest-head'+mw.test.numberOfHeader+'"><th colspan="4">' + escapedtitle + '</th></tr>' ); |
| 56 | + this.$table.append( |
| 57 | + '<tr class="mw-mwutiltest-head" id="mw-mwutiltest-head' |
| 58 | + + mw.test.numberOfHeader + '"><th colspan="4">' |
| 59 | + + escapedtitle + '</th></tr>' |
| 60 | + ); |
57 | 61 | return true; |
58 | 62 | }, |
59 | 63 | |
— | — | @@ -69,27 +73,35 @@ |
70 | 74 | // Build page |
71 | 75 | document.title = 'mediaWiki JavaScript library test suite - ' + mw.config.get( 'wgSiteName' ); |
72 | 76 | $( '#firstHeading' ).text( 'mediaWiki JavaScript library test suite' ); |
73 | | - var skinLinksText = 'Test in: ', |
| 77 | + var skinLinksHtml = 'Test in: ', |
74 | 78 | skinLinks = [], |
75 | 79 | availableSkins = mw.config.get( 'wgAvailableSkins' ), |
76 | 80 | skincode = ''; |
77 | 81 | for ( skincode in availableSkins ) { |
78 | | - skinLinks.push( mw.html.element( 'a', { |
79 | | - 'href': mw.util.wikiGetlink( wgPageName ) + '?action=mwutiltest&debug=true&useskin=' + encodeURIComponent( skincode ) |
80 | | - }, availableSkins[skincode] ) ); |
| 82 | + skinLinks.push( |
| 83 | + mw.html.element( |
| 84 | + 'a', { |
| 85 | + 'href': mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ) |
| 86 | + + '?action=mwutiltest&debug=true&useskin=' + encodeURIComponent( skincode ) |
| 87 | + }, |
| 88 | + availableSkins[skincode] |
| 89 | + ) |
| 90 | + ); |
81 | 91 | } |
82 | | - skinLinksText += skinLinks.join( ' | ' ) + '.'; |
| 92 | + skinLinksHtml += skinLinks.join( ' | ' ) + '.'; |
83 | 93 | mw.util.$content.html( |
84 | 94 | '<p>Below is a list of tests to confirm proper functionality of the mediaWiki JavaScript library</p>' |
85 | | - + '<p>' + skinLinksText + '</p>' |
| 95 | + + '<p>' + skinLinksHtml + '</p>' |
86 | 96 | + '<hr />' |
87 | | - + '<table id="mw-mwutiltest-table" class="wikitable" style="white-space:break; font-family:monospace,\'Courier New\'; width:100%;">' |
| 97 | + + '<table id="mw-mwutiltest-table" class="wikitable"' |
| 98 | + + ' style="white-space:break; font-family:monospace,\'Courier New\'; width:100%;">' |
88 | 99 | + '<tr><th>Exec</th><th>Should return</th><th>Does return</th><th>Equal ?</th></tr>' |
89 | 100 | + '</table>' |
90 | 101 | ); |
91 | 102 | |
92 | 103 | mw.util.addCSS( |
93 | | - '#mw-mwutiltest-table tr td { padding:0 !important; }' // Override wikitable padding for <td> |
| 104 | + // Override wikitable padding for <td> |
| 105 | + '#mw-mwutiltest-table tr td { padding:0 !important; }' |
94 | 106 | ); |
95 | 107 | |
96 | 108 | mw.test.$table = $( 'table#mw-mwutiltest-table' ); |
— | — | @@ -269,10 +281,12 @@ |
270 | 282 | mw.test.addTest( 'typeof mw.util.addCSS', |
271 | 283 | 'function (string)' ); |
272 | 284 | |
273 | | - mw.test.addTest( 'var a = mw.util.addCSS( "#mw-js-message { background-color: #AFA !important; }" ); a.disabled;', |
274 | | - 'false (boolean)', |
275 | | - '(boolean)' ); |
| 285 | + mw.test.addTest( 'var a = mw.util.addCSS( "div#mw-js-message { background-color: rgb(170,255,170); }" ); a.disabled', |
| 286 | + 'false (boolean)' ); |
276 | 287 | |
| 288 | + mw.test.addTest( 'jQuery( "#mw-js-message " ).css( "background-color" )', |
| 289 | + 'rgb(170, 255, 170) (string)' ); |
| 290 | + |
277 | 291 | mw.test.addTest( 'typeof mw.util.toggleToc', |
278 | 292 | 'function (string)' ); |
279 | 293 | |
— | — | @@ -303,9 +317,6 @@ |
304 | 318 | mw.test.addTest( 'mw.util.$content.size()', |
305 | 319 | '1 (number)' ); |
306 | 320 | |
307 | | - mw.test.addTest( 'mw.util.isMainPage()', |
308 | | - 'false (boolean)' ); |
309 | | - |
310 | 321 | mw.test.addTest( 'typeof mw.util.addPortletLink', |
311 | 322 | 'function (string)' ); |
312 | 323 | |
— | — | @@ -447,20 +458,22 @@ |
448 | 459 | } |
449 | 460 | doesReturn = doesReturn + ' (' + typeof doesReturn + ')'; |
450 | 461 | var $thisrow = $testrows.eq( i - numberOfHeaders ); // since headers are rows as well |
451 | | - $thisrow.find( '> td' ).eq(2).html( mw.html.escape( doesReturn ).replace(/ /g, ' ' ) ); |
| 462 | + $thisrow.find( '> td' ) |
| 463 | + .eq(2) |
| 464 | + .html( mw.html.escape( doesReturn ).replace(/ /g, ' ' ) ); |
452 | 465 | |
453 | 466 | if ( doesReturn.indexOf( shouldcontain ) !== -1 ) { |
454 | 467 | if ( doesReturn == shouldreturn ) { |
455 | | - $thisrow.find( '> td' ).eq(3).css( 'background', '#AFA' ).text( 'OK' ); |
| 468 | + $thisrow.find( '>td' ).eq(3).css( 'background', '#AFA' ).text( 'OK' ); |
456 | 469 | numberOfPasseds++; |
457 | 470 | headNumberOfPasseds++; |
458 | 471 | } else { |
459 | | - $thisrow.find( '> td' ).eq(3).css( 'background', '#FFA' ).html( '<small>PARTIALLY</small>' ); |
| 472 | + $thisrow.find( '>td' ).eq(3).css( 'background', '#FFA' ).html( '<small>PARTIALLY</small>' ); |
460 | 473 | numberOfPartials++; |
461 | 474 | headNumberOfPartials++; |
462 | 475 | } |
463 | 476 | } else { |
464 | | - $thisrow.css( 'background', '#FAA' ).find( '> td' ).eq(3).text( 'ERROR' ); |
| 477 | + $thisrow.css( 'background', '#FAA' ).find( '>td' ).eq(3).text( 'ERROR' ); |
465 | 478 | numberOfErrors++; |
466 | 479 | headNumberOfErrors++; |
467 | 480 | } |