Skip to content

Commit 88ad7f2

Browse files
committed
test a bunch of mocks for noop react redraws
1 parent b856ad8 commit 88ad7f2

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

test/jasmine/tests/plot_api_test.js

+39-1
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,7 @@ describe('Test plot api', function() {
23272327
// legend and ticks get called initially, but then plot gets added during automargin
23282328
countCalls({doLegend: 1, doTicksRelayout: 1, plot: 1});
23292329

2330-
data = [{x: [0, 1], y: [0, 1], z: [[1, 2], [3, 4]], type: 'surface'}];
2330+
data = [{z: [[1, 2], [3, 4]], type: 'surface'}];
23312331
layout = {};
23322332

23332333
return Plotly.react(gd, data, layout);
@@ -2563,6 +2563,44 @@ describe('Test plot api', function() {
25632563
.catch(fail)
25642564
.then(done);
25652565
});
2566+
2567+
var mockList = [
2568+
['1', require('@mocks/1.json')],
2569+
['4', require('@mocks/4.json')],
2570+
['5', require('@mocks/5.json')],
2571+
['10', require('@mocks/10.json')],
2572+
['11', require('@mocks/11.json')],
2573+
['17', require('@mocks/17.json')],
2574+
['21', require('@mocks/21.json')],
2575+
['22', require('@mocks/22.json')],
2576+
// ['airfoil', require('@mocks/airfoil.json')],
2577+
['annotations-autorange', require('@mocks/annotations-autorange.json')],
2578+
['axes_enumerated_ticks', require('@mocks/axes_enumerated_ticks.json')],
2579+
['axes_visible-false', require('@mocks/axes_visible-false.json')],
2580+
['bar_and_histogram', require('@mocks/bar_and_histogram.json')],
2581+
['binding', require('@mocks/binding.json')],
2582+
['cheater_smooth', require('@mocks/cheater_smooth.json')],
2583+
['finance_style', require('@mocks/finance_style.json')],
2584+
['geo_first', require('@mocks/geo_first.json')],
2585+
['gl2d_line_dash', require('@mocks/gl2d_line_dash.json')],
2586+
['gl2d_parcoords_2', require('@mocks/gl2d_parcoords_2.json')],
2587+
['gl2d_pointcloud-basic', require('@mocks/gl2d_pointcloud-basic.json')],
2588+
['gl3d_world-cals', require('@mocks/gl3d_world-cals.json')],
2589+
['gl3d_set-ranges', require('@mocks/gl3d_set-ranges.json')]
2590+
];
2591+
2592+
mockList.forEach(function(mockSpec) {
2593+
it('can redraw "' + mockSpec[0] + '" with no changes as a noop', function(done) {
2594+
var mock = mockSpec[1];
2595+
2596+
Plotly.newPlot(gd, mock)
2597+
.then(countPlots)
2598+
.then(function() { return Plotly.react(gd, mock); })
2599+
.then(function() { countCalls({}); })
2600+
.catch(fail)
2601+
.then(done);
2602+
});
2603+
});
25662604
});
25672605
});
25682606

0 commit comments

Comments
 (0)