|
1 | 1 | var Plotly = require('@lib');
|
2 | 2 | var Lib = require('@src/lib');
|
3 | 3 | var Plots = require('@src/plots/plots');
|
4 |
| -var plotApi = require('@src/plot_api/plot_api'); |
5 | 4 | var SUBPLOT_PATTERN = require('@src/plots/cartesian/constants').SUBPLOT_PATTERN;
|
6 | 5 |
|
7 | 6 | var d3 = require('d3');
|
@@ -697,23 +696,43 @@ describe('Test splom interactions:', function() {
|
697 | 696 | expect(gl.drawingBufferHeight).toBe(h, msg);
|
698 | 697 | }
|
699 | 698 |
|
700 |
| - spyOn(plotApi, 'plot').and.callThrough(); |
| 699 | + var methods = ['cleanPlot', 'supplyDefaults', 'doCalcdata']; |
| 700 | + |
| 701 | + methods.forEach(function(m) { spyOn(Plots, m).and.callThrough(); }); |
| 702 | + |
| 703 | + function assetsFnCall(msg, exp) { |
| 704 | + methods.forEach(function(m) { |
| 705 | + expect(Plots[m]).toHaveBeenCalledTimes(exp[m], msg); |
| 706 | + Plots[m].calls.reset(); |
| 707 | + }); |
| 708 | + } |
| 709 | + |
701 | 710 | spyOn(Lib, 'log');
|
702 | 711 |
|
703 | 712 | Plotly.plot(gd, fig).then(function() {
|
704 |
| - expect(plotApi.plot).toHaveBeenCalledTimes(0); |
| 713 | + assetsFnCall('base', { |
| 714 | + cleanPlot: 1, // called once from inside Plots.supplyDefaults |
| 715 | + supplyDefaults: 1, |
| 716 | + doCalcdata: 1 |
| 717 | + }); |
| 718 | + assertDims('base', 600, 500); |
705 | 719 | expect(Lib.log).toHaveBeenCalledTimes(0);
|
706 | 720 | expect(gd._fullLayout._redrawFromWrongGlDimensions).toBeUndefined();
|
707 |
| - assertDims('base', 600, 500); |
| 721 | + |
| 722 | + spyOn(gd._fullData[0]._module, 'plot').and.callThrough(); |
708 | 723 |
|
709 | 724 | return Plotly.relayout(gd, {width: 4810, height: 3656});
|
710 | 725 | })
|
711 | 726 | .then(function() {
|
712 |
| - expect(plotApi.plot).toHaveBeenCalledTimes(1); |
| 727 | + assetsFnCall('after', { |
| 728 | + cleanPlot: 4, // 3 three from supplyDefaults, once in drawFramework |
| 729 | + supplyDefaults: 3, // 1 from relayout, 1 from automargin, 1 in drawFramework |
| 730 | + doCalcdata: 1 // once in drawFramework |
| 731 | + }); |
| 732 | + assertDims('after', 4810, 3656); |
713 | 733 | expect(Lib.log)
|
714 | 734 | .toHaveBeenCalledWith('WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug. Clearing graph and plotting again.');
|
715 | 735 | expect(gd._fullLayout._redrawFromWrongGlDimensions).toBe(1);
|
716 |
| - assertDims('base', 4810, 3656); |
717 | 736 | })
|
718 | 737 | .catch(failTest)
|
719 | 738 | .then(done);
|
|
0 commit comments