Skip to content

Commit

Permalink
change ordering of spy creation to avoid overwrites (mapbox#839)
Browse files Browse the repository at this point in the history
  • Loading branch information
drewsynan authored and mcwhittemore committed Nov 20, 2018
1 parent 578b817 commit 75a15d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion test/direct_select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ test('direct_select', t => {
const mapContainer = document.createElement('div');
document.body.appendChild(mapContainer);
const map = createMap({ container: mapContainer });
spy(map, 'fire');

const Draw = new MapboxDraw();
map.addControl(Draw);

spy(map, 'fire');

const afterNextRender = setupAfterNextRender(map);

const cleanUp = function(cb) {
Expand Down
7 changes: 4 additions & 3 deletions test/simple_select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ test('simple_select', t => {
const mapContainer = document.createElement('div');
document.body.appendChild(mapContainer);
const map = createMap({ container: mapContainer });

const Draw = new MapboxDraw();
map.addControl(Draw);

spy(map, 'fire');
spy(map.doubleClickZoom, 'enable');
spy(map.doubleClickZoom, 'disable');
spy(map.dragPan, 'enable');
spy(map.dragPan, 'disable');

const Draw = new MapboxDraw();
map.addControl(Draw);

const afterNextRender = setupAfterNextRender(map);

const cleanUp = function(cb) {
Expand Down
8 changes: 4 additions & 4 deletions test/static.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import createMap from './utils/create_map';
test('static', t => {

const map = createMap();
spy(map, 'fire');
map.dragPan.disable();
spy(map.dragPan, 'disable');

const opts = {
modes: {
static: require('@mapbox/mapbox-gl-draw-static-mode')
Expand All @@ -23,6 +19,10 @@ test('static', t => {
const Draw = new MapboxDraw(opts);
map.addControl(Draw);

spy(map, 'fire');
map.dragPan.disable();
spy(map.dragPan, 'disable');

const afterNextRender = setupAfterNextRender(map);

const cleanUp = function(cb) {
Expand Down

0 comments on commit 75a15d2

Please sign in to comment.