diff --git a/test/unit/ui/map/isMoving.test.js b/test/unit/ui/map/isMoving.test.js index f3d7bba5b7e..908620ccb94 100644 --- a/test/unit/ui/map/isMoving.test.js +++ b/test/unit/ui/map/isMoving.test.js @@ -5,10 +5,12 @@ import Map from '../../../../src/ui/map.js'; import * as DOM from '../../../../src/util/dom.js'; import simulate from '../../../util/simulate_interaction.js'; -function createMap(t) { +function createMap(t, proj = 'mercator') { t.stub(Map.prototype, '_detectMissingCSS'); t.stub(Map.prototype, '_authenticate'); - return new Map({container: DOM.create('div', '', window.document.body)}); + const map = new Map({container: DOM.create('div', '', window.document.body)}); + map.setProjection(proj); + return map; } // MouseEvent.buttons @@ -21,20 +23,26 @@ test('Map#isMoving returns false by default', (t) => { t.end(); }); -test('Map#isMoving returns true during a camera zoom animation', (t) => { - const map = createMap(t); +test('Map#isMoving with various projections', (t) => { + const projections = ['globe', 'mercator']; + for (const proj of projections) { + test('Map#isMoving returns true during a camera zoom animation', (t) => { + const map = createMap(t, proj); - map.on('zoomstart', () => { - t.equal(map.isMoving(), true); - }); + map.on('zoomstart', () => { + t.equal(map.isMoving(), true); + }); - map.on('zoomend', () => { - t.equal(map.isMoving(), false); - map.remove(); - t.end(); - }); + map.on('zoomend', () => { + t.equal(map.isMoving(), false); + map.remove(); + t.end(); + }); - map.zoomTo(5, {duration: 0}); + map.zoomTo(5, {duration: 0}); + }); + } + t.end(); }); test('Map#isMoving returns true when drag panning', (t) => { diff --git a/test/unit/ui/map/isRotating.test.js b/test/unit/ui/map/isRotating.test.js index 35a59f8404a..6fb7c7fab12 100644 --- a/test/unit/ui/map/isRotating.test.js +++ b/test/unit/ui/map/isRotating.test.js @@ -5,10 +5,12 @@ import * as DOM from '../../../../src/util/dom.js'; import simulate from '../../../util/simulate_interaction.js'; import browser from '../../../../src/util/browser.js'; -function createMap(t) { +function createMap(t, proj = 'mercator') { t.stub(Map.prototype, '_detectMissingCSS'); t.stub(Map.prototype, '_authenticate'); - return new Map({container: DOM.create('div', '', window.document.body)}); + const map = new Map({container: DOM.create('div', '', window.document.body)}); + map.setProjection(proj); + return map; } test('Map#isRotating returns false by default', (t) => { @@ -18,20 +20,26 @@ test('Map#isRotating returns false by default', (t) => { t.end(); }); -test('Map#isRotating returns true during a camera rotate animation', (t) => { - const map = createMap(t); +test('#MapisRotating with various projections', (t) => { + const projections = ['globe', 'mercator']; + for (const proj of projections) { + test('Map#isRotating returns true during a camera rotate animation', (t) => { + const map = createMap(t, proj); - map.on('rotatestart', () => { - t.equal(map.isRotating(), true); - }); + map.on('rotatestart', () => { + t.equal(map.isRotating(), true); + }); - map.on('rotateend', () => { - t.equal(map.isRotating(), false); - map.remove(); - t.end(); - }); + map.on('rotateend', () => { + t.equal(map.isRotating(), false); + map.remove(); + t.end(); + }); - map.rotateTo(5, {duration: 0}); + map.rotateTo(5, {duration: 0}); + }); + } + t.end(); }); test('Map#isRotating returns true when drag rotating', (t) => {