Skip to content

Commit

Permalink
add *legend3dandfriends* to list of class names to fix gradient URL
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Dec 24, 2019
1 parent 3920eed commit b4ac79e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/snapshot/tosvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module.exports = function toSVG(gd, format, scale) {
}
});

svg.selectAll('.point, .scatterpts, .legendfill>path, .legendlines>path, .cbfill').each(function() {
svg.selectAll('.point, .scatterpts, .legendfill>path, .legendlines>path, path.legend3dandfriends, .cbfill').each(function() {
var pt = d3.select(this);

// similar to font family styles above,
Expand Down
18 changes: 18 additions & 0 deletions test/jasmine/tests/snapshot_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,24 @@ describe('Plotly.Snapshot', function() {
.catch(failTest)
.then(done);
});

it('- legend3dandfriends case', function(done) {
var fig = Lib.extendDeep({}, require('@mocks/geo_choropleth-legend.json'));

Plotly.plot(gd, fig)
.then(function() { return Plotly.Snapshot.toSVG(gd); })
.then(function(svg) {
var svgDOM = parser.parseFromString(svg, 'image/svg+xml');

var fillItems = svgDOM.getElementsByClassName('legend3dandfriends');
expect(fillItems.length).toBe(4, '# of legend items');
for(var i = 0; i < fillItems.length; i++) {
checkURL(fillItems[i].style.fill, 'fill gradient ' + i);
}
})
.catch(failTest)
.then(done);
});
});

it('should adapt *viewBox* attribute under *scale* option', function(done) {
Expand Down

0 comments on commit b4ac79e

Please sign in to comment.