Skip to content

Commit c16cbfb

Browse files
committed
Test unsetting plotly-customdata via animation
1 parent 3d992f0 commit c16cbfb

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/traces/scatter/plot.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,14 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
428428
}
429429

430430
join.each(function(d) {
431-
var sel = transition(d3.select(this));
431+
var el = d3.select(this);
432+
var sel = transition(el);
432433
Drawing.translatePoint(d, sel, xa, ya);
433434
Drawing.singlePointStyle(d, sel, trace);
435+
436+
if(trace.customdata) {
437+
el.classed('plotly-customdata', d.data !== null && d.data !== undefined);
438+
}
434439
});
435440

436441
if(hasTransition) {

src/traces/scatter/style.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ module.exports = function style(gd) {
3030

3131
pts.call(Drawing.pointStyle, trace);
3232

33-
if(trace.customdata) {
34-
pts.each(function(cd) {
35-
d3.select(this).classed('plotly-customdata', cd.data !== null && cd.data !== undefined);
36-
});
37-
}
38-
3933
el.selectAll('text')
4034
.call(Drawing.textPointStyle, trace);
4135
});

test/jasmine/tests/scatter_test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,17 @@ describe('end-to-end scatter tests', function() {
358358
points.each(function(cd, i) {
359359
expect(d3.select(this).classed('plotly-customdata')).toBe(expected[i]);
360360
});
361+
362+
return Plotly.animate(gd, [{
363+
data: [{customdata: []}]
364+
}], {frame: {redraw: false, duration: 0}});
365+
}).then(function() {
366+
var points = d3.selectAll('g.scatterlayer').selectAll('.point');
367+
368+
points.each(function() {
369+
expect(d3.select(this).classed('plotly-customdata')).toBe(false);
370+
});
371+
361372
}).catch(fail).then(done);
362373
});
363374
});

0 commit comments

Comments
 (0)