http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89942
Revision: 89942
Author: krinkle
Date: 2011-06-13 00:47:15 +0000 (Mon, 13 Jun 2011)
Log Message:
-----------
Replacing strictEqual-assertion with a more useful QUnit.push that includes the
expected and actual values in the html output. This way debugging problems from
the TestSwarm will be easier.
This way we end up with:
"Expected: > 100, Result: 99"
instead of:
"Expected: true, Result: false"
which could virtually mean anything (even null, undefined, string, array, you
name it)
* Also fixed issue in jquery.colorUtil.js
Modified Paths:
--------------
trunk/phase3/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.js
trunk/phase3/tests/qunit/suites/resources/jquery/jquery.colorUtil.js
trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js
Modified:
trunk/phase3/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.js
===================================================================
--- trunk/phase3/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.js
2011-06-12 23:22:11 UTC (rev 89941)
+++ trunk/phase3/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.js
2011-06-13 00:47:15 UTC (rev 89942)
@@ -23,6 +23,23 @@
test( 'Position right', function() {
expect(3);
+ /**
+ * Extra QUnit assertions
+ * Needed in order to include the expected and actual values in the
output.
+ * This way we end up with:
+ * "Expected: > 100, Result: 99"
+ * instead of:
+ * "Expected: true, Result: false"
+ */
+ // Expect numerical value less than or equal to X
+ var ltOrEq = function( actual, expected, message ) {
+ QUnit.push( actual <= expected, actual, 'less than or equal to
' + expected, message );
+ };
+ // Expect numerical value greater than X
+ var gt = function( actual, expected, message ) {
+ QUnit.push( actual > expected, actual, 'greater than ' +
expected, message );
+ };
+
// We need this thing to be visible, so append it to the DOM
var origText = 'This is a really long random string and there is no way
it fits in 100 pixels.';
var $wrapper = createWrappedDiv( origText );
@@ -35,7 +52,7 @@
// Check that the text fits by turning on word wrapping
$span.css( 'whiteSpace', 'nowrap' );
- strictEqual( $span.width() <= $span.parent().width(), true, "Text fits
(span's width is no larger than its parent's width)" );
+ ltOrEq( $span.width(), $span.parent().width(), "Text fits (span's width
is no larger than its parent's width)" );
// Add one character using scary black magic
var spanText = $span.text();
@@ -44,7 +61,7 @@
// Put this text in the span and verify it doesn't fit
$span.text( spanText );
- strictEqual( $span.width() > $span.parent().width(), true, 'Fit is
maximal (adding one character makes it not fit any more)' );
+ gt( $span.width(), $span.parent().width(), 'Fit is maximal (adding one
character makes it not fit any more)' );
// Clean up
$wrapper.remove();
Modified: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.colorUtil.js
===================================================================
--- trunk/phase3/tests/qunit/suites/resources/jquery/jquery.colorUtil.js
2011-06-12 23:22:11 UTC (rev 89941)
+++ trunk/phase3/tests/qunit/suites/resources/jquery/jquery.colorUtil.js
2011-06-13 00:47:15 UTC (rev 89942)
@@ -28,7 +28,7 @@
strictEqual( $.colorUtil.getRGB( 'rgba(0,0,0,0)' ), undefined, 'Zero
rgba without whitespace' );
deepEqual( $.colorUtil.getRGB( 'lightGreen' ), [144, 238, 144], 'Color
names (lightGreen)' );
- deepEqual( $.colorUtil.getRGB( 'lightGreen' ), [144, 238, 144], 'Color
names (transparent)' );
+ deepEqual( $.colorUtil.getRGB( 'transparent' ), [255, 255, 255], 'Color
names (transparent)' );
strictEqual( $.colorUtil.getRGB( 'mediaWiki' ), undefined, 'Inexisting
color name' );
});
Modified: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js
===================================================================
--- trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js
2011-06-12 23:22:11 UTC (rev 89941)
+++ trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js
2011-06-13 00:47:15 UTC (rev 89942)
@@ -16,6 +16,7 @@
test( 'mw.Map', function() {
expect(15);
+
ok( mw.Map, 'mw.Map defined' );
var conf = new mw.Map(),
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs