r88061 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88060‎ | r88061 | r88062 >
Date:12:48, 14 May 2011
Author:krinkle
Status:resolved
Tags:
Comment:
Adding QUnit tests for mw.loader (Follow-up r88053)
Modified paths:
  • /trunk/phase3/resources/mediawiki.action/mediawiki.action.history.js (modified) (history)
  • /trunk/phase3/resources/test/unit/mediawiki.util/mediawiki.util.js (modified) (history)
  • /trunk/phase3/resources/test/unit/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.history.js
@@ -13,7 +13,7 @@
1414 $lis.removeClass( 'selected' );
1515 $lis.each( function() {
1616 var $this = $(this);
17 - var $inputs = $this.find( 'input[type=radio]' );
 17+ var $inputs = $this.find( 'input[type="radio"]' );
1818 if ( $inputs.length !== 2 ) {
1919 return true;
2020 }
@@ -47,7 +47,7 @@
4848 });
4949 return true;
5050 };
51 -
 51+
5252 var fixCompare = function () {
5353 var $diffList = $( '#pagehistory' ),
5454 $histForm = $( '#mw-history-compare' ),
@@ -59,21 +59,22 @@
6060 }
6161 var copyAttrs = ['title', 'accesskey'];
6262 $buttons.each(function() {
 63+ console.log(this);
6364 var $button = $(this),
6465 $compareLink= $( '<a></a>', {
65 - 'class': 'compare-link',
66 - 'text': $button.val()
67 - }).button();
68 - $.each(copyAttrs, function(i, name) {
69 - var val = $button.attr(name);
 66+ 'class': 'compare-link',
 67+ 'text': $button.val()
 68+ }).button();
 69+ $.each( copyAttrs, function( i, name ) {
 70+ var val = $button.attr( name );
7071 if (val) {
71 - $compareLink.attr(name, val);
 72+ $compareLink.attr( name, val );
7273 }
7374 });
74 - $button.replaceWith($compareLink);
 75+ $button.replaceWith( $compareLink );
7576 });
7677 var updateCompare = function() {
77 - var $radio = $histForm.find( 'input[type=radio]:checked' );
 78+ var $radio = $histForm.find( 'input[type="radio"]:checked' );
7879 var genLink = mw.config.get( 'wgScript' )
7980 + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) )
8081 + '&diff=' + $radio.eq(0).val()
Index: trunk/phase3/resources/test/unit/mediawiki.util/mediawiki.util.js
@@ -109,8 +109,6 @@
110110
111111 });
112112
113 -
114 -
115113 test( 'isIPv6Address', function(){
116114
117115 // Based on IPTest.php > IPv6
@@ -123,7 +121,6 @@
124122
125123 });
126124
127 -
128125 test( 'isIPv4Address', function(){
129126
130127 // Based on IPTest.php > IPv4
Index: trunk/phase3/resources/test/unit/mediawiki/mediawiki.js
@@ -128,16 +128,18 @@
129129 });
130130
131131 test( 'mw.loader', function(){
 132+ expect(1);
132133
133 - ok( mw.loader, 'loader defined' );
134 - ok( mw.loader.work, 'loader.work defined' );
135 - ok( mw.loader.register, 'loader.register defined' );
136 - ok( mw.loader.implement, 'loader.implement defined' );
137 - ok( mw.loader.using, 'loader.using defined' );
138 - ok( mw.loader.load, 'loader.load defined' );
139 - ok( mw.loader.go, 'loader.go defined' );
140 - ok( mw.loader.state, 'loader.state defined' );
141 - ok( mw.loader.version, 'loader.version defined' );
 134+ stop();
 135+
 136+ mw.loader.implement( 'is.awesome', [location.href.match(/[^#\?]*/)[0] + 'sample/awesome.js'], {}, {} );
 137+ mw.loader.using( 'is.awesome', function(){
 138+ start();
 139+ same( window.awesome, true, 'Implementing a module, is the callback timed properly ?');
 140+ }, function(){
 141+ start();
 142+ same( 'mw.loader.using error callback fired', true, 'Implementing a module, is the callback timed properly ?');
 143+ });
142144
143145 });
144146

Follow-up revisions

RevisionCommit summaryAuthorDate
r88065Adding files missing in r88061krinkle12:54, 14 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88053Added direct file loading functionality to debug mode for both scripts and st...tparscal12:15, 14 May 2011

Status & tagging log