mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-17 04:43:18 +00:00
Merge "Make progress bar qunit tests more robust"
This commit is contained in:
commit
0db0cf2f9e
|
@ -26,7 +26,8 @@
|
||||||
|
|
||||||
QUnit.test( 'animateTo()', 8, function ( assert ) {
|
QUnit.test( 'animateTo()', 8, function ( assert ) {
|
||||||
var $qf = $( '#qunit-fixture' ),
|
var $qf = $( '#qunit-fixture' ),
|
||||||
progress = new mw.mmv.ui.ProgressBar( $qf );
|
$div = $( '<div>' ).css( { width: 250, position: 'relative' } ).appendTo( $qf ),
|
||||||
|
progress = new mw.mmv.ui.ProgressBar( $div );
|
||||||
|
|
||||||
assert.ok( progress.$progress.hasClass( 'empty' ), 'Progress bar is hidden' );
|
assert.ok( progress.$progress.hasClass( 'empty' ), 'Progress bar is hidden' );
|
||||||
assert.strictEqual( progress.$percent.width(), 0, 'Progress bar\'s indicator is at 0' );
|
assert.strictEqual( progress.$percent.width(), 0, 'Progress bar\'s indicator is at 0' );
|
||||||
|
@ -37,7 +38,8 @@
|
||||||
} );
|
} );
|
||||||
progress.animateTo( 50 );
|
progress.animateTo( 50 );
|
||||||
assert.ok( !progress.$progress.hasClass( 'empty' ), 'Progress bar is visible' );
|
assert.ok( !progress.$progress.hasClass( 'empty' ), 'Progress bar is visible' );
|
||||||
assert.strictEqual( progress.$percent.width(), $qf.width() / 2, 'Progress bar\'s indicator is at half' );
|
|
||||||
|
assert.strictEqual( progress.$percent.width(), 125, 'Progress bar\'s indicator is at half' );
|
||||||
|
|
||||||
$.fn.animate.restore();
|
$.fn.animate.restore();
|
||||||
this.sandbox.stub( $.fn, 'animate', function ( target, duration, transition, callback ) {
|
this.sandbox.stub( $.fn, 'animate', function ( target, duration, transition, callback ) {
|
||||||
|
@ -56,7 +58,8 @@
|
||||||
|
|
||||||
QUnit.test( 'jumpTo()/hide()', 6, function ( assert ) {
|
QUnit.test( 'jumpTo()/hide()', 6, function ( assert ) {
|
||||||
var $qf = $( '#qunit-fixture' ),
|
var $qf = $( '#qunit-fixture' ),
|
||||||
progress = new mw.mmv.ui.ProgressBar( $qf );
|
$div = $( '<div>' ).css( { width: 250, position: 'relative' } ).appendTo( $qf ),
|
||||||
|
progress = new mw.mmv.ui.ProgressBar( $div );
|
||||||
|
|
||||||
assert.ok( progress.$progress.hasClass( 'empty' ), 'Progress bar is hidden' );
|
assert.ok( progress.$progress.hasClass( 'empty' ), 'Progress bar is hidden' );
|
||||||
assert.strictEqual( progress.$percent.width(), 0, 'Progress bar\'s indicator is at 0' );
|
assert.strictEqual( progress.$percent.width(), 0, 'Progress bar\'s indicator is at 0' );
|
||||||
|
@ -64,7 +67,7 @@
|
||||||
progress.jumpTo( 50 );
|
progress.jumpTo( 50 );
|
||||||
|
|
||||||
assert.ok( !progress.$progress.hasClass( 'empty' ), 'Progress bar is visible' );
|
assert.ok( !progress.$progress.hasClass( 'empty' ), 'Progress bar is visible' );
|
||||||
assert.strictEqual( progress.$percent.width(), $qf.width() / 2, 'Progress bar\'s indicator is at half' );
|
assert.strictEqual( progress.$percent.width(), 125, 'Progress bar\'s indicator is at half' );
|
||||||
|
|
||||||
progress.hide();
|
progress.hide();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue