Matthias Mullie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/353886 )

Change subject: Fix mmw.ui.metadataPanel qunit tests
......................................................................

Fix mmw.ui.metadataPanel qunit tests

Bug: T164473
Change-Id: Iefad324be86c59ac9bf44363bcbbb98a70769499
---
M tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer 
refs/changes/86/353886/1

diff --git a/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js 
b/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
index cebc223..539bc09 100644
--- a/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
@@ -113,7 +113,9 @@
                                getArticlePath: function () { return 'Foo'; },
                                isCommons: function () { return false; }
                        },
-                       oldMoment = window.moment;
+                       oldMoment = window.moment,
+                       // custom clock will give MPP.formatDate some time to 
load moment.js
+                       clock = this.sandbox.useFakeTimers();
 
                /* window.moment = function ( date ) {
                        // This has no effect for now, since writing this test 
revealed that our moment.js
@@ -142,6 +144,7 @@
 
                panel.setImageInfo( image, imageData, repoData );
                creditPopupText = panel.creditField.$element.attr( 
'original-title' );
+               clock.tick( 10 );
 
                assert.strictEqual( panel.$title.text(), title, 'Title is 
correctly set' );
                assert.ok( !panel.$credit.hasClass( 'empty' ), 'Credit is not 
empty' );
@@ -157,10 +160,12 @@
 
                imageData.creationDateTime = undefined;
                panel.setImageInfo( image, imageData, repoData );
+               clock.tick( 10 );
 
                assert.ok( panel.$datetime.text().indexOf( '25 August 2013' ) > 
0, 'Correct date is displayed' );
 
                window.moment = oldMoment;
+               clock.restore();
        } );
 
        QUnit.test( 'Setting permission information works as expected', 1, 
function ( assert ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/353886
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefad324be86c59ac9bf44363bcbbb98a70769499
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to