MCPcopy
hub / github.com/plotly/plotly.js / testAutosize

Function testAutosize

test/jasmine/tests/config_test.js:48–101  ·  view source on GitHub ↗
(autosize, config, layoutHeight, relayoutHeight, done)

Source from the content-addressed store, hash-verified

46 }
47
48 function testAutosize(autosize, config, layoutHeight, relayoutHeight, done) {
49 var layout = {
50 autosize: autosize,
51 width: layoutWidth
52 };
53 var relayout = {
54 width: relayoutWidth,
55 // didn't need this before #3120 - but since we're now
56 // implicitly clearing autosize when edit width, if you really
57 // want height to re-autosize you need to explicitly re-add
58 // autosize
59 autosize: autosize
60 };
61
62 var layout2 = Lib.extendDeep({}, layout);
63
64 gd.style.width = containerWidthBeforePlot + 'px';
65 gd.style.height = containerHeightBeforePlot + 'px';
66
67 function beforeResize() {
68 checkLayoutSize(layoutWidth, layoutHeight);
69 if(!autosize) compareLayoutAndFullLayout(gd);
70
71 gd.style.width = containerWidthBeforeRelayout + 'px';
72 gd.style.height = containerHeightBeforeRelayout + 'px';
73 }
74
75 function afterResize() {
76 checkLayoutSize(relayoutWidth, relayoutHeight);
77 if(!autosize) compareLayoutAndFullLayout(gd);
78 }
79
80 Plotly.newPlot(gd, data, layout, config).then(function() {
81 beforeResize();
82
83 return Plotly.relayout(gd, relayout);
84 })
85 .then(afterResize)
86 // now redo with Plotly.react
87 .then(function() {
88 gd.style.width = containerWidthBeforePlot + 'px';
89 gd.style.height = containerHeightBeforePlot + 'px';
90
91 return Plotly.newPlot(gd, data, layout2, config);
92 })
93 .then(function() {
94 beforeResize();
95
96 layout2.width = relayoutWidth;
97 return Plotly.react(gd, data, layout2, config);
98 })
99 .then(afterResize)
100 .then(done, done.fail);
101 }
102
103 it('should fill the frame when autosize: false, fillFrame: true, frameMargins: undefined', function(done) {
104 var autosize = false;

Callers 1

config_test.jsFile · 0.85

Calls 1

beforeResizeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…