Skip to content

Commit 212ca7f

Browse files
author
Tom Chandler
committed
Fixed invalid Promise syntax in Plotly.restyle
1 parent 06c4894 commit 212ca7f

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/plot_api/plot_api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ Plotly.restyle = function restyle(gd, astr, val, traces) {
15721572
}
15731573
else {
15741574
console.log('restyle fail',astr,val,traces);
1575-
return new Promise.reject();
1575+
return Promise.reject();
15761576
}
15771577

15781578
if(Object.keys(aobj).length) gd.changed = true;

test/jasmine/tests/plot_promise_test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,30 @@ describe('Plotly.___ methods', function() {
331331
});
332332
});
333333

334+
describe('Plotly.restyle promise', function() {
335+
var promise,
336+
promiseRejected = false;
337+
338+
beforeEach(function(done) {
339+
var data = [{ x: [1,2,3], y: [4,5,6] }],
340+
initialDiv = createGraphDiv();
341+
342+
Plotly.plot(initialDiv, data, {});
343+
344+
promise = Plotly.restyle(initialDiv, undefined, '');
345+
346+
promise.then(null, function(){
347+
promiseRejected = true;
348+
done();
349+
});
350+
});
351+
afterEach(destroyGraphDiv);
352+
353+
it('should be rejected when the attribute is missing', function() {
354+
expect(promiseRejected).toBe(true);
355+
});
356+
});
357+
334358
describe('Plotly.relayout promise', function() {
335359
var promise,
336360
promiseGd;

0 commit comments

Comments
 (0)