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 );
// 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();
// 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();
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' );
});