Skip to content

Commit 7fc8514

Browse files
committed
Add jasmine test
1 parent d692c7e commit 7fc8514

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/jasmine/tests/plots_test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,3 +1326,41 @@ describe('grids', function() {
13261326
.then(done, done.fail);
13271327
});
13281328
});
1329+
1330+
describe('Test Plots with automargin and minreducedwidth/height', function() {
1331+
var gd;
1332+
1333+
beforeEach(function() {
1334+
gd = createGraphDiv();
1335+
});
1336+
1337+
afterEach(destroyGraphDiv);
1338+
1339+
it('should resize the plot area when tweaking min-reduced width & height', function(done) {
1340+
function assert(attr, exp) {
1341+
var xy = d3Select('rect.nsewdrag')[0][0];
1342+
expect(xy.getAttribute(attr)).toEqual(exp);
1343+
}
1344+
1345+
var fig = require('@mocks/z-automargin-minreducedheight.json');
1346+
1347+
Plotly.newPlot(gd, fig)
1348+
.then(function() {
1349+
assert('height', '55');
1350+
})
1351+
.then(function() {
1352+
return Plotly.relayout(gd, 'margin.minreducedheight', 100);
1353+
})
1354+
.then(function() {
1355+
assert('height', '100');
1356+
})
1357+
.then(function() {
1358+
return Plotly.relayout(gd, 'margin.minreducedwidth', 100);
1359+
})
1360+
.then(function() {
1361+
assert('width', '100');
1362+
assert('height', '100');
1363+
})
1364+
.then(done, done.fail);
1365+
});
1366+
});

0 commit comments

Comments
 (0)