mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-28 01:50:09 +00:00
Fix mmv.logging.ViewLogger qunit tests
Bug: T164473 Change-Id: I11849743773e0382354009ccec1c8cb39c466aef
This commit is contained in:
parent
47d67a6e66
commit
934ed2d2dd
|
@ -2,6 +2,18 @@
|
||||||
QUnit.module( 'mmv.logging.ViewLogger', QUnit.newMwEnvironment( {
|
QUnit.module( 'mmv.logging.ViewLogger', QUnit.newMwEnvironment( {
|
||||||
setup: function () {
|
setup: function () {
|
||||||
this.clock = this.sandbox.useFakeTimers();
|
this.clock = this.sandbox.useFakeTimers();
|
||||||
|
|
||||||
|
// since jQuery 2/3, $.now will capture a reference to Date.now
|
||||||
|
// before above fake timer gets a chance to override it, so I'll
|
||||||
|
// override that new behavior in order to run these tests...
|
||||||
|
// @see https://github.com/sinonjs/lolex/issues/76
|
||||||
|
this.oldNow = $.now;
|
||||||
|
$.now = function() { return +( new Date() ); };
|
||||||
|
},
|
||||||
|
|
||||||
|
teardown: function () {
|
||||||
|
$.now = this.oldNow;
|
||||||
|
this.clock.restore();
|
||||||
}
|
}
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue