Fix mmv.logging.ViewLogger qunit tests

Bug: T164473
Change-Id: I11849743773e0382354009ccec1c8cb39c466aef
This commit is contained in:
Matthias Mullie 2017-05-15 15:01:23 +02:00 committed by Matthias Mullie
parent 47d67a6e66
commit 934ed2d2dd

View file

@ -2,6 +2,18 @@
QUnit.module( 'mmv.logging.ViewLogger', QUnit.newMwEnvironment( {
setup: function () {
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();
}
} ) );