From eb99a1777e4cf1a56e3d9f62da0bab4c818ba2a1 Mon Sep 17 00:00:00 2001 From: fuzhenn Date: Wed, 4 Oct 2017 17:46:36 +0800 Subject: [PATCH] fix util.now --- build/karma.cover.config.js | 3 ++- src/core/util/common.js | 3 --- test/core/UtilSpec.js | 7 +++++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build/karma.cover.config.js b/build/karma.cover.config.js index cc1236ed8a..553450b3cf 100644 --- a/build/karma.cover.config.js +++ b/build/karma.cover.config.js @@ -23,7 +23,8 @@ module.exports = function (config) { const babel = require('maptalks-rollup-plugin-babel'); plugins.splice(idx, 1, babel({ plugins: [['istanbul', { - exclude: ['test/**/*.js', 'src/core/mapbox/*.js', 'src/util/dom.js', 'node_modules/**/*'] + // TileLayerGLRenderer is not testable on CI + exclude: ['test/**/*.js', 'src/core/mapbox/*.js', 'src/util/dom.js', 'src/renderer/layer/tilelayer/TileLayerGLRenderer', 'node_modules/**/*'] }]] })); } diff --git a/src/core/util/common.js b/src/core/util/common.js index 895d904348..42c0fde343 100644 --- a/src/core/util/common.js +++ b/src/core/util/common.js @@ -1,7 +1,4 @@ export function now() { - if (typeof performance !== 'undefined' && performance.now) { - return performance.now(); - } return Date.now(); } diff --git a/test/core/UtilSpec.js b/test/core/UtilSpec.js index 57746d14df..597f2ce309 100644 --- a/test/core/UtilSpec.js +++ b/test/core/UtilSpec.js @@ -26,6 +26,13 @@ describe('Util', function () { expect(maptalks.Util.sign(2)).to.be.eql(1); }); + it('now', function () { + var now = Date.now(); + var now2 = maptalks.Util.now(); + + expect(now2 >= now).to.be.ok(); + }); + it('getSymbolStamp', function () { var symbol = { 'markerType' : 'ellipse',