Skip to content

Commit d5f0962

Browse files
committed
Add canvas width test
1 parent 684195a commit d5f0962

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/plot_api/plot_api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ Plotly.plot = function(gd, data, layout, config) {
232232
.attr('width', fullLayout.width)
233233
.attr('height', fullLayout.height);
234234

235+
235236
return Lib.syncOrAsync([
236237
subroutines.layoutStyles
237238
], gd);

test/jasmine/tests/gl2d_plot_interact_test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,25 @@ describe('Test gl plot side effects', function() {
184184
})
185185
.then(done);
186186
});
187+
188+
it('should be able to resize canvas properly', function(done) {
189+
var _mock = Lib.extendDeep({}, require('@mocks/gl2d_10.json'));
190+
_mock.data[0].line.width = 5;
191+
192+
_mock.layout.width = 600;
193+
194+
Plotly.plot(gd, _mock)
195+
.then(function() {
196+
expect(gd.querySelector('.gl-canvas-context').width).toBe(600);
197+
198+
Plotly.relayout(gd, {width: 300});
199+
})
200+
.then(function() {
201+
expect(gd.querySelector('.gl-canvas-context').width).toBe(300);
202+
})
203+
.catch(fail)
204+
.then(done);
205+
});
187206
});
188207

189208
describe('Test gl2d plots', function() {

0 commit comments

Comments
 (0)