Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plots/mapbox/mapbox.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

// keep track of pan / zoom in user layout and emit relayout event
map.on('moveend', function(eventData) {
if(!self.map) return;

var view = self.getView();

opts._input.center = opts.center = view.center;
Expand DownExpand Up@@ -358,7 +360,10 @@ proto.updateLayers = function() {
};

proto.destroy = function() {
if(this.map) this.map.remove();
if(this.map) {
this.map.remove();
this.map = null;
}
this.container.removeChild(this.div);
};

Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/attributes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
'use strict';


var heatmapAttrs = require('../scatter/attributes');
var heatmapAttrs = require('../heatmap/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');

Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/karma.ciconf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ function func(config) {

func.defaultConfig.autoWatch = false;

func.defaultConfig.browsers = ['Firefox'];
func.defaultConfig.browsers = ['Firefox_WindowSized'];

config.set(func.defaultConfig);
}
Expand Down
6 changes: 5 additions & 1 deletion test/jasmine/karma.conf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,11 +82,15 @@ func.defaultConfig = {
browsers: ['Chrome_WindowSized'],

// custom browser options
// window-size values came from observing default size
customLaunchers: {
Chrome_WindowSized: {
base: 'Chrome',
// window-size values came from observing default size
flags: ['--window-size=1035,617', '--ignore-gpu-blacklist']
},
Firefox_WindowSized: {
base: 'Firefox',
flags: ['--width=1035', '--height=617']
}
},

Expand Down
18 changes: 6 additions & 12 deletions test/jasmine/tests/download_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var textchartMock = require('@mocks/text_chart_arrays.json');

var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

describe('Plotly.downloadImage', function() {
'use strict';
var gd;
var originalTimeout;

// override click handler on createElement
// so these tests will not actually
Expand All@@ -27,16 +28,10 @@ describe('Plotly.downloadImage', function() {

beforeEach(function() {
gd = createGraphDiv();

// downloadImage can take a little longer
// so give it a little more time to finish
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});

afterEach(function() {
destroyGraphDiv();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

it('should be attached to Plotly', function() {
Expand All@@ -45,11 +40,11 @@ describe('Plotly.downloadImage', function() {

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'jpeg', done);
});
}, LONG_TIMEOUT_INTERVAL);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jasmine/jasmine@68ba5b6 for example.


it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'png', done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
checkWebp(function(supported) {
Expand All@@ -59,12 +54,11 @@ describe('Plotly.downloadImage', function() {
done();
}
});

});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'svg', done);
});
}, LONG_TIMEOUT_INTERVAL);
});


Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/hover_label_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,9 +726,9 @@ describe('hover on fill', function() {
mock.data.forEach(function(trace) { trace.hoveron = 'fills'; });

Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(function() {
return assertLabelsCorrect([242, 142], [249.175, 133.8], 'trace 2');
return assertLabelsCorrect([242, 142], [252, 133.8], 'trace 2');
}).then(function() {
return assertLabelsCorrect([242, 292], [231.125, 210], 'trace 1');
return assertLabelsCorrect([242, 292], [233, 210], 'trace 1');
}).then(function() {
return assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0');
}).then(done);
Expand All@@ -749,7 +749,7 @@ describe('hover on fill', function() {
}).then(function() {
return assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1');
}).then(function() {
return assertLabelsCorrect([237, 251], [247.7, 254], 'trace 0');
return assertLabelsCorrect([237, 240], [247.7, 254], 'trace 0');

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alexcjohnson these cases ⬆️ were tuned for FF on CI and Chrome locally. Now, they work locally in FF and Chrome as well as FF on CI.

}).then(function() {
// zoom in to test clipping of large out-of-viewport shapes
return Plotly.relayout(gd, {
Expand Down
79 changes: 48 additions & 31 deletions test/jasmine/tests/mapbox_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
var TRANSITION_DELAY = 500;
var MOUSE_DELAY = 100;
var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

var noop = function() {};

Expand DownExpand Up@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}]);
}).toThrow(new Error(constants.noAccessTokenErrorMsg));
});
}, LONG_TIMEOUT_INTERVAL);

it('should throw error if token is invalid', function(done) {
var cnt = 0;
Expand All@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}], {}, {
mapboxAccessToken: dummyToken
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(constants.mapOnErrorMsg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should use access token in mapbox layout options if present', function(done) {
var cnt = 0;
Expand All@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should bypass access token in mapbox layout options when config points to an Atlas server', function(done) {
var cnt = 0;
Expand All@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
}
}, {
mapboxAccessToken: ''
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(msg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);
});

describe('mapbox plots', function() {
Expand DownExpand Up@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

return Plotly.restyle(gd, 'visible', 'legendonly', [1]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var mockCopy = Lib.extendDeep({}, mock);
mockCopy.data[0].visible = false;

return Plotly.newPlot(gd, mockCopy.data, mockCopy.layout);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to delete and add traces', function(done) {
var modes = ['line', 'circle'];
Expand All@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var trace = {
Expand All@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(3);

return Plotly.deleteTraces(gd, [0, 1, 2]);
}).then(function() {
})
.then(function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to restyle', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
]);
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to relayout', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
assertLayout('Mapbox Dark', [0, 0], 1.234, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.zoom', '6');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(2);

assertLayout('Mapbox Dark', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.style', 'light');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(3);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.domain.x', [0, 0.5]);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(4);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 270]);

return Plotly.relayout(gd, 'mapbox.domain.y[0]', 0.5);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(5);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 135]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to add, update and remove layers', function(done) {
var mockWithLayers = require('@mocks/mapbox_layers');
Expand DownExpand Up@@ -623,7 +639,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update the access token', function(done) {
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) {
Expand All@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
expect(gd._promises.length).toEqual(0);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update traces', function(done) {
function assertDataPts(lengths) {
Expand DownExpand Up@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
};

return Plotly.extendTraces(gd, update, [0, 1]);
}).then(function() {
})
.then(function() {
assertDataPts([5, 5]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should display to hover labels on mouse over', function(done) {
function assertMouseMove(pos, len) {
Expand All@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
assertMouseMove(blankPos, 0).then(function() {
return assertMouseMove(pointPos, 1);
}).then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to hover interactions by', function(done) {
var hoverCnt = 0,
Expand DownExpand Up@@ -736,7 +753,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond drag / scroll interactions', function(done) {
var relayoutCnt = 0,
Expand DownExpand Up@@ -795,7 +812,7 @@ describe('mapbox plots', function() {

// TODO test scroll

});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to click interactions by', function(done) {
var ptData;
Expand DownExpand Up@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
});
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

function getMapInfo(gd) {
var subplot = gd._fullLayout.mapbox._subplot,
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Make citest-jasmine pass locally by etpinard · Pull Request #1211 · plotly/plotly.js · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plots/mapbox/mapbox.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

// keep track of pan / zoom in user layout and emit relayout event
map.on('moveend', function(eventData) {
if(!self.map) return;

var view = self.getView();

opts._input.center = opts.center = view.center;
Expand DownExpand Up@@ -358,7 +360,10 @@ proto.updateLayers = function() {
};

proto.destroy = function() {
if(this.map) this.map.remove();
if(this.map) {
this.map.remove();
this.map = null;
}
this.container.removeChild(this.div);
};

Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/attributes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
'use strict';


var heatmapAttrs = require('../scatter/attributes');
var heatmapAttrs = require('../heatmap/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');

Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/karma.ciconf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ function func(config) {

func.defaultConfig.autoWatch = false;

func.defaultConfig.browsers = ['Firefox'];
func.defaultConfig.browsers = ['Firefox_WindowSized'];

config.set(func.defaultConfig);
}
Expand Down
6 changes: 5 additions & 1 deletion test/jasmine/karma.conf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,11 +82,15 @@ func.defaultConfig = {
browsers: ['Chrome_WindowSized'],

// custom browser options
// window-size values came from observing default size
customLaunchers: {
Chrome_WindowSized: {
base: 'Chrome',
// window-size values came from observing default size
flags: ['--window-size=1035,617', '--ignore-gpu-blacklist']
},
Firefox_WindowSized: {
base: 'Firefox',
flags: ['--width=1035', '--height=617']
}
},

Expand Down
18 changes: 6 additions & 12 deletions test/jasmine/tests/download_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var textchartMock = require('@mocks/text_chart_arrays.json');

var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

describe('Plotly.downloadImage', function() {
'use strict';
var gd;
var originalTimeout;

// override click handler on createElement
// so these tests will not actually
Expand All@@ -27,16 +28,10 @@ describe('Plotly.downloadImage', function() {

beforeEach(function() {
gd = createGraphDiv();

// downloadImage can take a little longer
// so give it a little more time to finish
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});

afterEach(function() {
destroyGraphDiv();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

it('should be attached to Plotly', function() {
Expand All@@ -45,11 +40,11 @@ describe('Plotly.downloadImage', function() {

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'jpeg', done);
});
}, LONG_TIMEOUT_INTERVAL);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jasmine/jasmine@68ba5b6 for example.


it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'png', done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
checkWebp(function(supported) {
Expand All@@ -59,12 +54,11 @@ describe('Plotly.downloadImage', function() {
done();
}
});

});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'svg', done);
});
}, LONG_TIMEOUT_INTERVAL);
});


Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/hover_label_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,9 +726,9 @@ describe('hover on fill', function() {
mock.data.forEach(function(trace) { trace.hoveron = 'fills'; });

Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(function() {
return assertLabelsCorrect([242, 142], [249.175, 133.8], 'trace 2');
return assertLabelsCorrect([242, 142], [252, 133.8], 'trace 2');
}).then(function() {
return assertLabelsCorrect([242, 292], [231.125, 210], 'trace 1');
return assertLabelsCorrect([242, 292], [233, 210], 'trace 1');
}).then(function() {
return assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0');
}).then(done);
Expand All@@ -749,7 +749,7 @@ describe('hover on fill', function() {
}).then(function() {
return assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1');
}).then(function() {
return assertLabelsCorrect([237, 251], [247.7, 254], 'trace 0');
return assertLabelsCorrect([237, 240], [247.7, 254], 'trace 0');

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alexcjohnson these cases ⬆️ were tuned for FF on CI and Chrome locally. Now, they work locally in FF and Chrome as well as FF on CI.

}).then(function() {
// zoom in to test clipping of large out-of-viewport shapes
return Plotly.relayout(gd, {
Expand Down
79 changes: 48 additions & 31 deletions test/jasmine/tests/mapbox_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
var TRANSITION_DELAY = 500;
var MOUSE_DELAY = 100;
var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

var noop = function() {};

Expand DownExpand Up@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}]);
}).toThrow(new Error(constants.noAccessTokenErrorMsg));
});
}, LONG_TIMEOUT_INTERVAL);

it('should throw error if token is invalid', function(done) {
var cnt = 0;
Expand All@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}], {}, {
mapboxAccessToken: dummyToken
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(constants.mapOnErrorMsg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should use access token in mapbox layout options if present', function(done) {
var cnt = 0;
Expand All@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should bypass access token in mapbox layout options when config points to an Atlas server', function(done) {
var cnt = 0;
Expand All@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
}
}, {
mapboxAccessToken: ''
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(msg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);
});

describe('mapbox plots', function() {
Expand DownExpand Up@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

return Plotly.restyle(gd, 'visible', 'legendonly', [1]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var mockCopy = Lib.extendDeep({}, mock);
mockCopy.data[0].visible = false;

return Plotly.newPlot(gd, mockCopy.data, mockCopy.layout);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to delete and add traces', function(done) {
var modes = ['line', 'circle'];
Expand All@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var trace = {
Expand All@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(3);

return Plotly.deleteTraces(gd, [0, 1, 2]);
}).then(function() {
})
.then(function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to restyle', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
]);
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to relayout', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
assertLayout('Mapbox Dark', [0, 0], 1.234, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.zoom', '6');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(2);

assertLayout('Mapbox Dark', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.style', 'light');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(3);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.domain.x', [0, 0.5]);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(4);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 270]);

return Plotly.relayout(gd, 'mapbox.domain.y[0]', 0.5);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(5);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 135]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to add, update and remove layers', function(done) {
var mockWithLayers = require('@mocks/mapbox_layers');
Expand DownExpand Up@@ -623,7 +639,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update the access token', function(done) {
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) {
Expand All@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
expect(gd._promises.length).toEqual(0);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update traces', function(done) {
function assertDataPts(lengths) {
Expand DownExpand Up@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
};

return Plotly.extendTraces(gd, update, [0, 1]);
}).then(function() {
})
.then(function() {
assertDataPts([5, 5]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should display to hover labels on mouse over', function(done) {
function assertMouseMove(pos, len) {
Expand All@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
assertMouseMove(blankPos, 0).then(function() {
return assertMouseMove(pointPos, 1);
}).then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to hover interactions by', function(done) {
var hoverCnt = 0,
Expand DownExpand Up@@ -736,7 +753,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond drag / scroll interactions', function(done) {
var relayoutCnt = 0,
Expand DownExpand Up@@ -795,7 +812,7 @@ describe('mapbox plots', function() {

// TODO test scroll

});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to click interactions by', function(done) {
var ptData;
Expand DownExpand Up@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
});
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

function getMapInfo(gd) {
var subplot = gd._fullLayout.mapbox._subplot,
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Make citest-jasmine pass locally by etpinard · Pull Request #1211 · plotly/plotly.js · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plots/mapbox/mapbox.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

// keep track of pan / zoom in user layout and emit relayout event
map.on('moveend', function(eventData) {
if(!self.map) return;

var view = self.getView();

opts._input.center = opts.center = view.center;
Expand DownExpand Up@@ -358,7 +360,10 @@ proto.updateLayers = function() {
};

proto.destroy = function() {
if(this.map) this.map.remove();
if(this.map) {
this.map.remove();
this.map = null;
}
this.container.removeChild(this.div);
};

Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/attributes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
'use strict';


var heatmapAttrs = require('../scatter/attributes');
var heatmapAttrs = require('../heatmap/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');

Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/karma.ciconf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ function func(config) {

func.defaultConfig.autoWatch = false;

func.defaultConfig.browsers = ['Firefox'];
func.defaultConfig.browsers = ['Firefox_WindowSized'];

config.set(func.defaultConfig);
}
Expand Down
6 changes: 5 additions & 1 deletion test/jasmine/karma.conf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,11 +82,15 @@ func.defaultConfig = {
browsers: ['Chrome_WindowSized'],

// custom browser options
// window-size values came from observing default size
customLaunchers: {
Chrome_WindowSized: {
base: 'Chrome',
// window-size values came from observing default size
flags: ['--window-size=1035,617', '--ignore-gpu-blacklist']
},
Firefox_WindowSized: {
base: 'Firefox',
flags: ['--width=1035', '--height=617']
}
},

Expand Down
18 changes: 6 additions & 12 deletions test/jasmine/tests/download_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var textchartMock = require('@mocks/text_chart_arrays.json');

var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

describe('Plotly.downloadImage', function() {
'use strict';
var gd;
var originalTimeout;

// override click handler on createElement
// so these tests will not actually
Expand All@@ -27,16 +28,10 @@ describe('Plotly.downloadImage', function() {

beforeEach(function() {
gd = createGraphDiv();

// downloadImage can take a little longer
// so give it a little more time to finish
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});

afterEach(function() {
destroyGraphDiv();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

it('should be attached to Plotly', function() {
Expand All@@ -45,11 +40,11 @@ describe('Plotly.downloadImage', function() {

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'jpeg', done);
});
}, LONG_TIMEOUT_INTERVAL);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jasmine/jasmine@68ba5b6 for example.


it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'png', done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
checkWebp(function(supported) {
Expand All@@ -59,12 +54,11 @@ describe('Plotly.downloadImage', function() {
done();
}
});

});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'svg', done);
});
}, LONG_TIMEOUT_INTERVAL);
});


Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/hover_label_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,9 +726,9 @@ describe('hover on fill', function() {
mock.data.forEach(function(trace) { trace.hoveron = 'fills'; });

Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(function() {
return assertLabelsCorrect([242, 142], [249.175, 133.8], 'trace 2');
return assertLabelsCorrect([242, 142], [252, 133.8], 'trace 2');
}).then(function() {
return assertLabelsCorrect([242, 292], [231.125, 210], 'trace 1');
return assertLabelsCorrect([242, 292], [233, 210], 'trace 1');
}).then(function() {
return assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0');
}).then(done);
Expand All@@ -749,7 +749,7 @@ describe('hover on fill', function() {
}).then(function() {
return assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1');
}).then(function() {
return assertLabelsCorrect([237, 251], [247.7, 254], 'trace 0');
return assertLabelsCorrect([237, 240], [247.7, 254], 'trace 0');

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alexcjohnson these cases ⬆️ were tuned for FF on CI and Chrome locally. Now, they work locally in FF and Chrome as well as FF on CI.

}).then(function() {
// zoom in to test clipping of large out-of-viewport shapes
return Plotly.relayout(gd, {
Expand Down
79 changes: 48 additions & 31 deletions test/jasmine/tests/mapbox_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
var TRANSITION_DELAY = 500;
var MOUSE_DELAY = 100;
var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

var noop = function() {};

Expand DownExpand Up@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}]);
}).toThrow(new Error(constants.noAccessTokenErrorMsg));
});
}, LONG_TIMEOUT_INTERVAL);

it('should throw error if token is invalid', function(done) {
var cnt = 0;
Expand All@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}], {}, {
mapboxAccessToken: dummyToken
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(constants.mapOnErrorMsg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should use access token in mapbox layout options if present', function(done) {
var cnt = 0;
Expand All@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should bypass access token in mapbox layout options when config points to an Atlas server', function(done) {
var cnt = 0;
Expand All@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
}
}, {
mapboxAccessToken: ''
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(msg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);
});

describe('mapbox plots', function() {
Expand DownExpand Up@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

return Plotly.restyle(gd, 'visible', 'legendonly', [1]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var mockCopy = Lib.extendDeep({}, mock);
mockCopy.data[0].visible = false;

return Plotly.newPlot(gd, mockCopy.data, mockCopy.layout);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to delete and add traces', function(done) {
var modes = ['line', 'circle'];
Expand All@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var trace = {
Expand All@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(3);

return Plotly.deleteTraces(gd, [0, 1, 2]);
}).then(function() {
})
.then(function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to restyle', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
]);
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to relayout', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
assertLayout('Mapbox Dark', [0, 0], 1.234, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.zoom', '6');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(2);

assertLayout('Mapbox Dark', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.style', 'light');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(3);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.domain.x', [0, 0.5]);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(4);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 270]);

return Plotly.relayout(gd, 'mapbox.domain.y[0]', 0.5);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(5);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 135]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to add, update and remove layers', function(done) {
var mockWithLayers = require('@mocks/mapbox_layers');
Expand DownExpand Up@@ -623,7 +639,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update the access token', function(done) {
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) {
Expand All@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
expect(gd._promises.length).toEqual(0);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update traces', function(done) {
function assertDataPts(lengths) {
Expand DownExpand Up@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
};

return Plotly.extendTraces(gd, update, [0, 1]);
}).then(function() {
})
.then(function() {
assertDataPts([5, 5]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should display to hover labels on mouse over', function(done) {
function assertMouseMove(pos, len) {
Expand All@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
assertMouseMove(blankPos, 0).then(function() {
return assertMouseMove(pointPos, 1);
}).then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to hover interactions by', function(done) {
var hoverCnt = 0,
Expand DownExpand Up@@ -736,7 +753,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond drag / scroll interactions', function(done) {
var relayoutCnt = 0,
Expand DownExpand Up@@ -795,7 +812,7 @@ describe('mapbox plots', function() {

// TODO test scroll

});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to click interactions by', function(done) {
var ptData;
Expand DownExpand Up@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
});
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

function getMapInfo(gd) {
var subplot = gd._fullLayout.mapbox._subplot,
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Make citest-jasmine pass locally by etpinard · Pull Request #1211 · plotly/plotly.js · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plots/mapbox/mapbox.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

// keep track of pan / zoom in user layout and emit relayout event
map.on('moveend', function(eventData) {
if(!self.map) return;

var view = self.getView();

opts._input.center = opts.center = view.center;
Expand DownExpand Up@@ -358,7 +360,10 @@ proto.updateLayers = function() {
};

proto.destroy = function() {
if(this.map) this.map.remove();
if(this.map) {
this.map.remove();
this.map = null;
}
this.container.removeChild(this.div);
};

Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/attributes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
'use strict';


var heatmapAttrs = require('../scatter/attributes');
var heatmapAttrs = require('../heatmap/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');

Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/karma.ciconf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ function func(config) {

func.defaultConfig.autoWatch = false;

func.defaultConfig.browsers = ['Firefox'];
func.defaultConfig.browsers = ['Firefox_WindowSized'];

config.set(func.defaultConfig);
}
Expand Down
6 changes: 5 additions & 1 deletion test/jasmine/karma.conf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,11 +82,15 @@ func.defaultConfig = {
browsers: ['Chrome_WindowSized'],

// custom browser options
// window-size values came from observing default size
customLaunchers: {
Chrome_WindowSized: {
base: 'Chrome',
// window-size values came from observing default size
flags: ['--window-size=1035,617', '--ignore-gpu-blacklist']
},
Firefox_WindowSized: {
base: 'Firefox',
flags: ['--width=1035', '--height=617']
}
},

Expand Down
18 changes: 6 additions & 12 deletions test/jasmine/tests/download_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var textchartMock = require('@mocks/text_chart_arrays.json');

var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

describe('Plotly.downloadImage', function() {
'use strict';
var gd;
var originalTimeout;

// override click handler on createElement
// so these tests will not actually
Expand All@@ -27,16 +28,10 @@ describe('Plotly.downloadImage', function() {

beforeEach(function() {
gd = createGraphDiv();

// downloadImage can take a little longer
// so give it a little more time to finish
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});

afterEach(function() {
destroyGraphDiv();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

it('should be attached to Plotly', function() {
Expand All@@ -45,11 +40,11 @@ describe('Plotly.downloadImage', function() {

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'jpeg', done);
});
}, LONG_TIMEOUT_INTERVAL);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jasmine/jasmine@68ba5b6 for example.


it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'png', done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
checkWebp(function(supported) {
Expand All@@ -59,12 +54,11 @@ describe('Plotly.downloadImage', function() {
done();
}
});

});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'svg', done);
});
}, LONG_TIMEOUT_INTERVAL);
});


Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/hover_label_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,9 +726,9 @@ describe('hover on fill', function() {
mock.data.forEach(function(trace) { trace.hoveron = 'fills'; });

Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(function() {
return assertLabelsCorrect([242, 142], [249.175, 133.8], 'trace 2');
return assertLabelsCorrect([242, 142], [252, 133.8], 'trace 2');
}).then(function() {
return assertLabelsCorrect([242, 292], [231.125, 210], 'trace 1');
return assertLabelsCorrect([242, 292], [233, 210], 'trace 1');
}).then(function() {
return assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0');
}).then(done);
Expand All@@ -749,7 +749,7 @@ describe('hover on fill', function() {
}).then(function() {
return assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1');
}).then(function() {
return assertLabelsCorrect([237, 251], [247.7, 254], 'trace 0');
return assertLabelsCorrect([237, 240], [247.7, 254], 'trace 0');

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alexcjohnson these cases ⬆️ were tuned for FF on CI and Chrome locally. Now, they work locally in FF and Chrome as well as FF on CI.

}).then(function() {
// zoom in to test clipping of large out-of-viewport shapes
return Plotly.relayout(gd, {
Expand Down
79 changes: 48 additions & 31 deletions test/jasmine/tests/mapbox_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
var TRANSITION_DELAY = 500;
var MOUSE_DELAY = 100;
var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

var noop = function() {};

Expand DownExpand Up@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}]);
}).toThrow(new Error(constants.noAccessTokenErrorMsg));
});
}, LONG_TIMEOUT_INTERVAL);

it('should throw error if token is invalid', function(done) {
var cnt = 0;
Expand All@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}], {}, {
mapboxAccessToken: dummyToken
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(constants.mapOnErrorMsg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should use access token in mapbox layout options if present', function(done) {
var cnt = 0;
Expand All@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should bypass access token in mapbox layout options when config points to an Atlas server', function(done) {
var cnt = 0;
Expand All@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
}
}, {
mapboxAccessToken: ''
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(msg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);
});

describe('mapbox plots', function() {
Expand DownExpand Up@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

return Plotly.restyle(gd, 'visible', 'legendonly', [1]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var mockCopy = Lib.extendDeep({}, mock);
mockCopy.data[0].visible = false;

return Plotly.newPlot(gd, mockCopy.data, mockCopy.layout);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to delete and add traces', function(done) {
var modes = ['line', 'circle'];
Expand All@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var trace = {
Expand All@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(3);

return Plotly.deleteTraces(gd, [0, 1, 2]);
}).then(function() {
})
.then(function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to restyle', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
]);
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to relayout', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
assertLayout('Mapbox Dark', [0, 0], 1.234, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.zoom', '6');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(2);

assertLayout('Mapbox Dark', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.style', 'light');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(3);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.domain.x', [0, 0.5]);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(4);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 270]);

return Plotly.relayout(gd, 'mapbox.domain.y[0]', 0.5);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(5);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 135]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to add, update and remove layers', function(done) {
var mockWithLayers = require('@mocks/mapbox_layers');
Expand DownExpand Up@@ -623,7 +639,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update the access token', function(done) {
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) {
Expand All@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
expect(gd._promises.length).toEqual(0);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update traces', function(done) {
function assertDataPts(lengths) {
Expand DownExpand Up@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
};

return Plotly.extendTraces(gd, update, [0, 1]);
}).then(function() {
})
.then(function() {
assertDataPts([5, 5]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should display to hover labels on mouse over', function(done) {
function assertMouseMove(pos, len) {
Expand All@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
assertMouseMove(blankPos, 0).then(function() {
return assertMouseMove(pointPos, 1);
}).then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to hover interactions by', function(done) {
var hoverCnt = 0,
Expand DownExpand Up@@ -736,7 +753,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond drag / scroll interactions', function(done) {
var relayoutCnt = 0,
Expand DownExpand Up@@ -795,7 +812,7 @@ describe('mapbox plots', function() {

// TODO test scroll

});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to click interactions by', function(done) {
var ptData;
Expand DownExpand Up@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
});
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

function getMapInfo(gd) {
var subplot = gd._fullLayout.mapbox._subplot,
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Make citest-jasmine pass locally by etpinard · Pull Request #1211 · plotly/plotly.js · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plots/mapbox/mapbox.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

// keep track of pan / zoom in user layout and emit relayout event
map.on('moveend', function(eventData) {
if(!self.map) return;

var view = self.getView();

opts._input.center = opts.center = view.center;
Expand DownExpand Up@@ -358,7 +360,10 @@ proto.updateLayers = function() {
};

proto.destroy = function() {
if(this.map) this.map.remove();
if(this.map) {
this.map.remove();
this.map = null;
}
this.container.removeChild(this.div);
};

Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/attributes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
'use strict';


var heatmapAttrs = require('../scatter/attributes');
var heatmapAttrs = require('../heatmap/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');

Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/karma.ciconf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ function func(config) {

func.defaultConfig.autoWatch = false;

func.defaultConfig.browsers = ['Firefox'];
func.defaultConfig.browsers = ['Firefox_WindowSized'];

config.set(func.defaultConfig);
}
Expand Down
6 changes: 5 additions & 1 deletion test/jasmine/karma.conf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,11 +82,15 @@ func.defaultConfig = {
browsers: ['Chrome_WindowSized'],

// custom browser options
// window-size values came from observing default size
customLaunchers: {
Chrome_WindowSized: {
base: 'Chrome',
// window-size values came from observing default size
flags: ['--window-size=1035,617', '--ignore-gpu-blacklist']
},
Firefox_WindowSized: {
base: 'Firefox',
flags: ['--width=1035', '--height=617']
}
},

Expand Down
18 changes: 6 additions & 12 deletions test/jasmine/tests/download_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var textchartMock = require('@mocks/text_chart_arrays.json');

var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

describe('Plotly.downloadImage', function() {
'use strict';
var gd;
var originalTimeout;

// override click handler on createElement
// so these tests will not actually
Expand All@@ -27,16 +28,10 @@ describe('Plotly.downloadImage', function() {

beforeEach(function() {
gd = createGraphDiv();

// downloadImage can take a little longer
// so give it a little more time to finish
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});

afterEach(function() {
destroyGraphDiv();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

it('should be attached to Plotly', function() {
Expand All@@ -45,11 +40,11 @@ describe('Plotly.downloadImage', function() {

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'jpeg', done);
});
}, LONG_TIMEOUT_INTERVAL);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jasmine/jasmine@68ba5b6 for example.


it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'png', done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
checkWebp(function(supported) {
Expand All@@ -59,12 +54,11 @@ describe('Plotly.downloadImage', function() {
done();
}
});

});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'svg', done);
});
}, LONG_TIMEOUT_INTERVAL);
});


Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/hover_label_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,9 +726,9 @@ describe('hover on fill', function() {
mock.data.forEach(function(trace) { trace.hoveron = 'fills'; });

Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(function() {
return assertLabelsCorrect([242, 142], [249.175, 133.8], 'trace 2');
return assertLabelsCorrect([242, 142], [252, 133.8], 'trace 2');
}).then(function() {
return assertLabelsCorrect([242, 292], [231.125, 210], 'trace 1');
return assertLabelsCorrect([242, 292], [233, 210], 'trace 1');
}).then(function() {
return assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0');
}).then(done);
Expand All@@ -749,7 +749,7 @@ describe('hover on fill', function() {
}).then(function() {
return assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1');
}).then(function() {
return assertLabelsCorrect([237, 251], [247.7, 254], 'trace 0');
return assertLabelsCorrect([237, 240], [247.7, 254], 'trace 0');

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alexcjohnson these cases ⬆️ were tuned for FF on CI and Chrome locally. Now, they work locally in FF and Chrome as well as FF on CI.

}).then(function() {
// zoom in to test clipping of large out-of-viewport shapes
return Plotly.relayout(gd, {
Expand Down
79 changes: 48 additions & 31 deletions test/jasmine/tests/mapbox_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
var TRANSITION_DELAY = 500;
var MOUSE_DELAY = 100;
var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

var noop = function() {};

Expand DownExpand Up@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}]);
}).toThrow(new Error(constants.noAccessTokenErrorMsg));
});
}, LONG_TIMEOUT_INTERVAL);

it('should throw error if token is invalid', function(done) {
var cnt = 0;
Expand All@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}], {}, {
mapboxAccessToken: dummyToken
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(constants.mapOnErrorMsg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should use access token in mapbox layout options if present', function(done) {
var cnt = 0;
Expand All@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should bypass access token in mapbox layout options when config points to an Atlas server', function(done) {
var cnt = 0;
Expand All@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
}
}, {
mapboxAccessToken: ''
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(msg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);
});

describe('mapbox plots', function() {
Expand DownExpand Up@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

return Plotly.restyle(gd, 'visible', 'legendonly', [1]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var mockCopy = Lib.extendDeep({}, mock);
mockCopy.data[0].visible = false;

return Plotly.newPlot(gd, mockCopy.data, mockCopy.layout);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to delete and add traces', function(done) {
var modes = ['line', 'circle'];
Expand All@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var trace = {
Expand All@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(3);

return Plotly.deleteTraces(gd, [0, 1, 2]);
}).then(function() {
})
.then(function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to restyle', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
]);
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to relayout', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
assertLayout('Mapbox Dark', [0, 0], 1.234, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.zoom', '6');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(2);

assertLayout('Mapbox Dark', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.style', 'light');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(3);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.domain.x', [0, 0.5]);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(4);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 270]);

return Plotly.relayout(gd, 'mapbox.domain.y[0]', 0.5);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(5);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 135]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to add, update and remove layers', function(done) {
var mockWithLayers = require('@mocks/mapbox_layers');
Expand DownExpand Up@@ -623,7 +639,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update the access token', function(done) {
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) {
Expand All@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
expect(gd._promises.length).toEqual(0);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update traces', function(done) {
function assertDataPts(lengths) {
Expand DownExpand Up@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
};

return Plotly.extendTraces(gd, update, [0, 1]);
}).then(function() {
})
.then(function() {
assertDataPts([5, 5]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should display to hover labels on mouse over', function(done) {
function assertMouseMove(pos, len) {
Expand All@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
assertMouseMove(blankPos, 0).then(function() {
return assertMouseMove(pointPos, 1);
}).then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to hover interactions by', function(done) {
var hoverCnt = 0,
Expand DownExpand Up@@ -736,7 +753,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond drag / scroll interactions', function(done) {
var relayoutCnt = 0,
Expand DownExpand Up@@ -795,7 +812,7 @@ describe('mapbox plots', function() {

// TODO test scroll

});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to click interactions by', function(done) {
var ptData;
Expand DownExpand Up@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
});
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

function getMapInfo(gd) {
var subplot = gd._fullLayout.mapbox._subplot,
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Make citest-jasmine pass locally by etpinard · Pull Request #1211 · plotly/plotly.js · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plots/mapbox/mapbox.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

// keep track of pan / zoom in user layout and emit relayout event
map.on('moveend', function(eventData) {
if(!self.map) return;

var view = self.getView();

opts._input.center = opts.center = view.center;
Expand DownExpand Up@@ -358,7 +360,10 @@ proto.updateLayers = function() {
};

proto.destroy = function() {
if(this.map) this.map.remove();
if(this.map) {
this.map.remove();
this.map = null;
}
this.container.removeChild(this.div);
};

Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/attributes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
'use strict';


var heatmapAttrs = require('../scatter/attributes');
var heatmapAttrs = require('../heatmap/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');

Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/karma.ciconf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ function func(config) {

func.defaultConfig.autoWatch = false;

func.defaultConfig.browsers = ['Firefox'];
func.defaultConfig.browsers = ['Firefox_WindowSized'];

config.set(func.defaultConfig);
}
Expand Down
6 changes: 5 additions & 1 deletion test/jasmine/karma.conf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,11 +82,15 @@ func.defaultConfig = {
browsers: ['Chrome_WindowSized'],

// custom browser options
// window-size values came from observing default size
customLaunchers: {
Chrome_WindowSized: {
base: 'Chrome',
// window-size values came from observing default size
flags: ['--window-size=1035,617', '--ignore-gpu-blacklist']
},
Firefox_WindowSized: {
base: 'Firefox',
flags: ['--width=1035', '--height=617']
}
},

Expand Down
18 changes: 6 additions & 12 deletions test/jasmine/tests/download_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var textchartMock = require('@mocks/text_chart_arrays.json');

var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

describe('Plotly.downloadImage', function() {
'use strict';
var gd;
var originalTimeout;

// override click handler on createElement
// so these tests will not actually
Expand All@@ -27,16 +28,10 @@ describe('Plotly.downloadImage', function() {

beforeEach(function() {
gd = createGraphDiv();

// downloadImage can take a little longer
// so give it a little more time to finish
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});

afterEach(function() {
destroyGraphDiv();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

it('should be attached to Plotly', function() {
Expand All@@ -45,11 +40,11 @@ describe('Plotly.downloadImage', function() {

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'jpeg', done);
});
}, LONG_TIMEOUT_INTERVAL);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jasmine/jasmine@68ba5b6 for example.


it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'png', done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
checkWebp(function(supported) {
Expand All@@ -59,12 +54,11 @@ describe('Plotly.downloadImage', function() {
done();
}
});

});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'svg', done);
});
}, LONG_TIMEOUT_INTERVAL);
});


Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/hover_label_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,9 +726,9 @@ describe('hover on fill', function() {
mock.data.forEach(function(trace) { trace.hoveron = 'fills'; });

Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(function() {
return assertLabelsCorrect([242, 142], [249.175, 133.8], 'trace 2');
return assertLabelsCorrect([242, 142], [252, 133.8], 'trace 2');
}).then(function() {
return assertLabelsCorrect([242, 292], [231.125, 210], 'trace 1');
return assertLabelsCorrect([242, 292], [233, 210], 'trace 1');
}).then(function() {
return assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0');
}).then(done);
Expand All@@ -749,7 +749,7 @@ describe('hover on fill', function() {
}).then(function() {
return assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1');
}).then(function() {
return assertLabelsCorrect([237, 251], [247.7, 254], 'trace 0');
return assertLabelsCorrect([237, 240], [247.7, 254], 'trace 0');

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alexcjohnson these cases ⬆️ were tuned for FF on CI and Chrome locally. Now, they work locally in FF and Chrome as well as FF on CI.

}).then(function() {
// zoom in to test clipping of large out-of-viewport shapes
return Plotly.relayout(gd, {
Expand Down
79 changes: 48 additions & 31 deletions test/jasmine/tests/mapbox_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
var TRANSITION_DELAY = 500;
var MOUSE_DELAY = 100;
var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

var noop = function() {};

Expand DownExpand Up@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}]);
}).toThrow(new Error(constants.noAccessTokenErrorMsg));
});
}, LONG_TIMEOUT_INTERVAL);

it('should throw error if token is invalid', function(done) {
var cnt = 0;
Expand All@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}], {}, {
mapboxAccessToken: dummyToken
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(constants.mapOnErrorMsg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should use access token in mapbox layout options if present', function(done) {
var cnt = 0;
Expand All@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should bypass access token in mapbox layout options when config points to an Atlas server', function(done) {
var cnt = 0;
Expand All@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
}
}, {
mapboxAccessToken: ''
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(msg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);
});

describe('mapbox plots', function() {
Expand DownExpand Up@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

return Plotly.restyle(gd, 'visible', 'legendonly', [1]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var mockCopy = Lib.extendDeep({}, mock);
mockCopy.data[0].visible = false;

return Plotly.newPlot(gd, mockCopy.data, mockCopy.layout);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to delete and add traces', function(done) {
var modes = ['line', 'circle'];
Expand All@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var trace = {
Expand All@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(3);

return Plotly.deleteTraces(gd, [0, 1, 2]);
}).then(function() {
})
.then(function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to restyle', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
]);
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to relayout', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
assertLayout('Mapbox Dark', [0, 0], 1.234, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.zoom', '6');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(2);

assertLayout('Mapbox Dark', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.style', 'light');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(3);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.domain.x', [0, 0.5]);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(4);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 270]);

return Plotly.relayout(gd, 'mapbox.domain.y[0]', 0.5);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(5);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 135]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to add, update and remove layers', function(done) {
var mockWithLayers = require('@mocks/mapbox_layers');
Expand DownExpand Up@@ -623,7 +639,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update the access token', function(done) {
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) {
Expand All@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
expect(gd._promises.length).toEqual(0);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update traces', function(done) {
function assertDataPts(lengths) {
Expand DownExpand Up@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
};

return Plotly.extendTraces(gd, update, [0, 1]);
}).then(function() {
})
.then(function() {
assertDataPts([5, 5]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should display to hover labels on mouse over', function(done) {
function assertMouseMove(pos, len) {
Expand All@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
assertMouseMove(blankPos, 0).then(function() {
return assertMouseMove(pointPos, 1);
}).then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to hover interactions by', function(done) {
var hoverCnt = 0,
Expand DownExpand Up@@ -736,7 +753,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond drag / scroll interactions', function(done) {
var relayoutCnt = 0,
Expand DownExpand Up@@ -795,7 +812,7 @@ describe('mapbox plots', function() {

// TODO test scroll

});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to click interactions by', function(done) {
var ptData;
Expand DownExpand Up@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
});
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

function getMapInfo(gd) {
var subplot = gd._fullLayout.mapbox._subplot,
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Make citest-jasmine pass locally by etpinard · Pull Request #1211 · plotly/plotly.js · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plots/mapbox/mapbox.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

// keep track of pan / zoom in user layout and emit relayout event
map.on('moveend', function(eventData) {
if(!self.map) return;

var view = self.getView();

opts._input.center = opts.center = view.center;
Expand DownExpand Up@@ -358,7 +360,10 @@ proto.updateLayers = function() {
};

proto.destroy = function() {
if(this.map) this.map.remove();
if(this.map) {
this.map.remove();
this.map = null;
}
this.container.removeChild(this.div);
};

Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/attributes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
'use strict';


var heatmapAttrs = require('../scatter/attributes');
var heatmapAttrs = require('../heatmap/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');

Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/karma.ciconf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ function func(config) {

func.defaultConfig.autoWatch = false;

func.defaultConfig.browsers = ['Firefox'];
func.defaultConfig.browsers = ['Firefox_WindowSized'];

config.set(func.defaultConfig);
}
Expand Down
6 changes: 5 additions & 1 deletion test/jasmine/karma.conf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,11 +82,15 @@ func.defaultConfig = {
browsers: ['Chrome_WindowSized'],

// custom browser options
// window-size values came from observing default size
customLaunchers: {
Chrome_WindowSized: {
base: 'Chrome',
// window-size values came from observing default size
flags: ['--window-size=1035,617', '--ignore-gpu-blacklist']
},
Firefox_WindowSized: {
base: 'Firefox',
flags: ['--width=1035', '--height=617']
}
},

Expand Down
18 changes: 6 additions & 12 deletions test/jasmine/tests/download_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var textchartMock = require('@mocks/text_chart_arrays.json');

var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

describe('Plotly.downloadImage', function() {
'use strict';
var gd;
var originalTimeout;

// override click handler on createElement
// so these tests will not actually
Expand All@@ -27,16 +28,10 @@ describe('Plotly.downloadImage', function() {

beforeEach(function() {
gd = createGraphDiv();

// downloadImage can take a little longer
// so give it a little more time to finish
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});

afterEach(function() {
destroyGraphDiv();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

it('should be attached to Plotly', function() {
Expand All@@ -45,11 +40,11 @@ describe('Plotly.downloadImage', function() {

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'jpeg', done);
});
}, LONG_TIMEOUT_INTERVAL);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jasmine/jasmine@68ba5b6 for example.


it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'png', done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
checkWebp(function(supported) {
Expand All@@ -59,12 +54,11 @@ describe('Plotly.downloadImage', function() {
done();
}
});

});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'svg', done);
});
}, LONG_TIMEOUT_INTERVAL);
});


Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/hover_label_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,9 +726,9 @@ describe('hover on fill', function() {
mock.data.forEach(function(trace) { trace.hoveron = 'fills'; });

Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(function() {
return assertLabelsCorrect([242, 142], [249.175, 133.8], 'trace 2');
return assertLabelsCorrect([242, 142], [252, 133.8], 'trace 2');
}).then(function() {
return assertLabelsCorrect([242, 292], [231.125, 210], 'trace 1');
return assertLabelsCorrect([242, 292], [233, 210], 'trace 1');
}).then(function() {
return assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0');
}).then(done);
Expand All@@ -749,7 +749,7 @@ describe('hover on fill', function() {
}).then(function() {
return assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1');
}).then(function() {
return assertLabelsCorrect([237, 251], [247.7, 254], 'trace 0');
return assertLabelsCorrect([237, 240], [247.7, 254], 'trace 0');

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alexcjohnson these cases ⬆️ were tuned for FF on CI and Chrome locally. Now, they work locally in FF and Chrome as well as FF on CI.

}).then(function() {
// zoom in to test clipping of large out-of-viewport shapes
return Plotly.relayout(gd, {
Expand Down
79 changes: 48 additions & 31 deletions test/jasmine/tests/mapbox_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
var TRANSITION_DELAY = 500;
var MOUSE_DELAY = 100;
var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

var noop = function() {};

Expand DownExpand Up@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}]);
}).toThrow(new Error(constants.noAccessTokenErrorMsg));
});
}, LONG_TIMEOUT_INTERVAL);

it('should throw error if token is invalid', function(done) {
var cnt = 0;
Expand All@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}], {}, {
mapboxAccessToken: dummyToken
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(constants.mapOnErrorMsg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should use access token in mapbox layout options if present', function(done) {
var cnt = 0;
Expand All@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should bypass access token in mapbox layout options when config points to an Atlas server', function(done) {
var cnt = 0;
Expand All@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
}
}, {
mapboxAccessToken: ''
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(msg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);
});

describe('mapbox plots', function() {
Expand DownExpand Up@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

return Plotly.restyle(gd, 'visible', 'legendonly', [1]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var mockCopy = Lib.extendDeep({}, mock);
mockCopy.data[0].visible = false;

return Plotly.newPlot(gd, mockCopy.data, mockCopy.layout);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to delete and add traces', function(done) {
var modes = ['line', 'circle'];
Expand All@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var trace = {
Expand All@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(3);

return Plotly.deleteTraces(gd, [0, 1, 2]);
}).then(function() {
})
.then(function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to restyle', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
]);
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to relayout', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
assertLayout('Mapbox Dark', [0, 0], 1.234, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.zoom', '6');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(2);

assertLayout('Mapbox Dark', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.style', 'light');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(3);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.domain.x', [0, 0.5]);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(4);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 270]);

return Plotly.relayout(gd, 'mapbox.domain.y[0]', 0.5);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(5);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 135]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to add, update and remove layers', function(done) {
var mockWithLayers = require('@mocks/mapbox_layers');
Expand DownExpand Up@@ -623,7 +639,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update the access token', function(done) {
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) {
Expand All@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
expect(gd._promises.length).toEqual(0);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update traces', function(done) {
function assertDataPts(lengths) {
Expand DownExpand Up@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
};

return Plotly.extendTraces(gd, update, [0, 1]);
}).then(function() {
})
.then(function() {
assertDataPts([5, 5]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should display to hover labels on mouse over', function(done) {
function assertMouseMove(pos, len) {
Expand All@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
assertMouseMove(blankPos, 0).then(function() {
return assertMouseMove(pointPos, 1);
}).then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to hover interactions by', function(done) {
var hoverCnt = 0,
Expand DownExpand Up@@ -736,7 +753,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond drag / scroll interactions', function(done) {
var relayoutCnt = 0,
Expand DownExpand Up@@ -795,7 +812,7 @@ describe('mapbox plots', function() {

// TODO test scroll

});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to click interactions by', function(done) {
var ptData;
Expand DownExpand Up@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
});
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

function getMapInfo(gd) {
var subplot = gd._fullLayout.mapbox._subplot,
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Make citest-jasmine pass locally by etpinard · Pull Request #1211 · plotly/plotly.js · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plots/mapbox/mapbox.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

// keep track of pan / zoom in user layout and emit relayout event
map.on('moveend', function(eventData) {
if(!self.map) return;

var view = self.getView();

opts._input.center = opts.center = view.center;
Expand DownExpand Up@@ -358,7 +360,10 @@ proto.updateLayers = function() {
};

proto.destroy = function() {
if(this.map) this.map.remove();
if(this.map) {
this.map.remove();
this.map = null;
}
this.container.removeChild(this.div);
};

Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/attributes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
'use strict';


var heatmapAttrs = require('../scatter/attributes');
var heatmapAttrs = require('../heatmap/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');

Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/karma.ciconf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ function func(config) {

func.defaultConfig.autoWatch = false;

func.defaultConfig.browsers = ['Firefox'];
func.defaultConfig.browsers = ['Firefox_WindowSized'];

config.set(func.defaultConfig);
}
Expand Down
6 changes: 5 additions & 1 deletion test/jasmine/karma.conf.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,11 +82,15 @@ func.defaultConfig = {
browsers: ['Chrome_WindowSized'],

// custom browser options
// window-size values came from observing default size
customLaunchers: {
Chrome_WindowSized: {
base: 'Chrome',
// window-size values came from observing default size
flags: ['--window-size=1035,617', '--ignore-gpu-blacklist']
},
Firefox_WindowSized: {
base: 'Firefox',
flags: ['--width=1035', '--height=617']
}
},

Expand Down
18 changes: 6 additions & 12 deletions test/jasmine/tests/download_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var textchartMock = require('@mocks/text_chart_arrays.json');

var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

describe('Plotly.downloadImage', function() {
'use strict';
var gd;
var originalTimeout;

// override click handler on createElement
// so these tests will not actually
Expand All@@ -27,16 +28,10 @@ describe('Plotly.downloadImage', function() {

beforeEach(function() {
gd = createGraphDiv();

// downloadImage can take a little longer
// so give it a little more time to finish
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});

afterEach(function() {
destroyGraphDiv();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

it('should be attached to Plotly', function() {
Expand All@@ -45,11 +40,11 @@ describe('Plotly.downloadImage', function() {

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'jpeg', done);
});
}, LONG_TIMEOUT_INTERVAL);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jasmine/jasmine@68ba5b6 for example.


it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'png', done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
checkWebp(function(supported) {
Expand All@@ -59,12 +54,11 @@ describe('Plotly.downloadImage', function() {
done();
}
});

});
}, LONG_TIMEOUT_INTERVAL);

it('should create link, remove link, accept options', function(done) {
downloadTest(gd, 'svg', done);
});
}, LONG_TIMEOUT_INTERVAL);
});


Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/hover_label_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,9 +726,9 @@ describe('hover on fill', function() {
mock.data.forEach(function(trace) { trace.hoveron = 'fills'; });

Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(function() {
return assertLabelsCorrect([242, 142], [249.175, 133.8], 'trace 2');
return assertLabelsCorrect([242, 142], [252, 133.8], 'trace 2');
}).then(function() {
return assertLabelsCorrect([242, 292], [231.125, 210], 'trace 1');
return assertLabelsCorrect([242, 292], [233, 210], 'trace 1');
}).then(function() {
return assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0');
}).then(done);
Expand All@@ -749,7 +749,7 @@ describe('hover on fill', function() {
}).then(function() {
return assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1');
}).then(function() {
return assertLabelsCorrect([237, 251], [247.7, 254], 'trace 0');
return assertLabelsCorrect([237, 240], [247.7, 254], 'trace 0');

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alexcjohnson these cases ⬆️ were tuned for FF on CI and Chrome locally. Now, they work locally in FF and Chrome as well as FF on CI.

}).then(function() {
// zoom in to test clipping of large out-of-viewport shapes
return Plotly.relayout(gd, {
Expand Down
79 changes: 48 additions & 31 deletions test/jasmine/tests/mapbox_test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ var customMatchers = require('../assets/custom_matchers');
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
var TRANSITION_DELAY = 500;
var MOUSE_DELAY = 100;
var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL;

var noop = function() {};

Expand DownExpand Up@@ -204,7 +205,7 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}]);
}).toThrow(new Error(constants.noAccessTokenErrorMsg));
});
}, LONG_TIMEOUT_INTERVAL);

it('should throw error if token is invalid', function(done) {
var cnt = 0;
Expand All@@ -215,14 +216,16 @@ describe('mapbox credentials', function() {
lat: [10, 20, 30]
}], {}, {
mapboxAccessToken: dummyToken
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(constants.mapOnErrorMsg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should use access token in mapbox layout options if present', function(done) {
var cnt = 0;
Expand All@@ -244,7 +247,7 @@ describe('mapbox credentials', function() {
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should bypass access token in mapbox layout options when config points to an Atlas server', function(done) {
var cnt = 0;
Expand All@@ -263,14 +266,16 @@ describe('mapbox credentials', function() {
}
}, {
mapboxAccessToken: ''
}).catch(function(err) {
})
.catch(function(err) {
cnt++;
expect(err).toEqual(new Error(msg));
}).then(function() {
})
.then(function() {
expect(cnt).toEqual(1);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);
});

describe('mapbox plots', function() {
Expand DownExpand Up@@ -310,27 +315,31 @@ describe('mapbox plots', function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

return Plotly.restyle(gd, 'visible', 'legendonly', [1]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var mockCopy = Lib.extendDeep({}, mock);
mockCopy.data[0].visible = false;

return Plotly.newPlot(gd, mockCopy.data, mockCopy.layout);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(1);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to delete and add traces', function(done) {
var modes = ['line', 'circle'];
Expand All@@ -348,7 +357,8 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(2);

var trace = {
Expand All@@ -359,16 +369,18 @@ describe('mapbox plots', function() {
};

return Plotly.addTraces(gd, [trace]);
}).then(function() {
})
.then(function() {
expect(countVisibleTraces(gd, modes)).toEqual(3);

return Plotly.deleteTraces(gd, [0, 1, 2]);
}).then(function() {
})
.then(function() {
expect(gd._fullLayout.mapbox).toBeUndefined();

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to restyle', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -425,7 +437,7 @@ describe('mapbox plots', function() {
]);
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to relayout', function(done) {
var restyleCnt = 0,
Expand DownExpand Up@@ -462,36 +474,40 @@ describe('mapbox plots', function() {
assertLayout('Mapbox Dark', [0, 0], 1.234, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.zoom', '6');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(2);

assertLayout('Mapbox Dark', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.style', 'light');
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(3);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 908, 270]);

return Plotly.relayout(gd, 'mapbox.domain.x', [0, 0.5]);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(4);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 270]);

return Plotly.relayout(gd, 'mapbox.domain.y[0]', 0.5);
}).then(function() {
})
.then(function() {
expect(restyleCnt).toEqual(0);
expect(relayoutCnt).toEqual(5);

assertLayout('Mapbox Light', [0, 0], 6, [80, 100, 454, 135]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to add, update and remove layers', function(done) {
var mockWithLayers = require('@mocks/mapbox_layers');
Expand DownExpand Up@@ -623,7 +639,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update the access token', function(done) {
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) {
Expand All@@ -637,7 +653,7 @@ describe('mapbox plots', function() {
expect(gd._promises.length).toEqual(0);
done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should be able to update traces', function(done) {
function assertDataPts(lengths) {
Expand DownExpand Up@@ -669,12 +685,13 @@ describe('mapbox plots', function() {
};

return Plotly.extendTraces(gd, update, [0, 1]);
}).then(function() {
})
.then(function() {
assertDataPts([5, 5]);

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should display to hover labels on mouse over', function(done) {
function assertMouseMove(pos, len) {
Expand All@@ -688,7 +705,7 @@ describe('mapbox plots', function() {
assertMouseMove(blankPos, 0).then(function() {
return assertMouseMove(pointPos, 1);
}).then(done);
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to hover interactions by', function(done) {
var hoverCnt = 0,
Expand DownExpand Up@@ -736,7 +753,7 @@ describe('mapbox plots', function() {

done();
});
});
}, LONG_TIMEOUT_INTERVAL);

it('should respond drag / scroll interactions', function(done) {
var relayoutCnt = 0,
Expand DownExpand Up@@ -795,7 +812,7 @@ describe('mapbox plots', function() {

// TODO test scroll

});
}, LONG_TIMEOUT_INTERVAL);

it('should respond to click interactions by', function(done) {
var ptData;
Expand DownExpand Up@@ -828,7 +845,7 @@ describe('mapbox plots', function() {
});
})
.then(done);
});
}, LONG_TIMEOUT_INTERVAL);

function getMapInfo(gd) {
var subplot = gd._fullLayout.mapbox._subplot,
Expand Down
Loading