Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add tests checking axis ranges after partial deletion
  • Loading branch information
etpinard committed Feb 26, 2016
commit 73817cbb34697f3fa8c87c5a670eb5b608f155fb
13 changes: 13 additions & 0 deletions test/jasmine/tests/plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var Lib = require('@src/lib');

var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var customMatchers = require('../assets/custom_matchers');


describe('Test plot structure', function() {
Expand Down Expand Up @@ -97,32 +98,44 @@ describe('Test plot structure', function() {
});

it('should restore layout axes when they get deleted', function(done) {
jasmine.addMatchers(customMatchers);

expect(countScatterTraces()).toEqual(mock.data.length);
expect(countSubplots()).toEqual(1);

Plotly.relayout(gd, {xaxis: null, yaxis: null}).then(function() {
expect(countScatterTraces()).toEqual(1);
expect(countSubplots()).toEqual(1);
expect(gd.layout.xaxis.range).toBeCloseToArray([-4.79980, 74.48580], 4);
expect(gd.layout.yaxis.range).toBeCloseToArray([-1.2662, 17.67023], 4);

return Plotly.relayout(gd, 'xaxis', null);
}).then(function() {
expect(countScatterTraces()).toEqual(1);
expect(countSubplots()).toEqual(1);
expect(gd.layout.xaxis.range).toBeCloseToArray([-4.79980, 74.48580], 4);
expect(gd.layout.yaxis.range).toBeCloseToArray([-1.2662, 17.67023], 4);

return Plotly.relayout(gd, 'xaxis', {});
}).then(function() {
expect(countScatterTraces()).toEqual(1);
expect(countSubplots()).toEqual(1);
expect(gd.layout.xaxis.range).toBeCloseToArray([-4.79980, 74.48580], 4);
expect(gd.layout.yaxis.range).toBeCloseToArray([-1.2662, 17.67023], 4);

return Plotly.relayout(gd, 'yaxis', null);
}).then(function() {
expect(countScatterTraces()).toEqual(1);
expect(countSubplots()).toEqual(1);
expect(gd.layout.xaxis.range).toBeCloseToArray([-4.79980, 74.48580], 4);
expect(gd.layout.yaxis.range).toBeCloseToArray([-1.2662, 17.67023], 4);

return Plotly.relayout(gd, 'yaxis', {});
}).then(function() {
expect(countScatterTraces()).toEqual(1);
expect(countSubplots()).toEqual(1);
expect(gd.layout.xaxis.range).toBeCloseToArray([-4.79980, 74.48580], 4);
expect(gd.layout.yaxis.range).toBeCloseToArray([-1.2662, 17.67023], 4);

done();
});
Expand Down