Skip to content

Commit 1ebc8c4

Browse files
archmojemilykl
authored andcommitted
Add jasmine test for restyling treemap marker.fillet attribute
1 parent 62dc7ea commit 1ebc8c4

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/jasmine/tests/treemap_test.js

+36
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,42 @@ describe('Test treemap restyle:', function() {
12941294
.then(_assert('back to dflt', ['Root', 'B', 'A\nnode1', 'b\nnode3']))
12951295
.then(done, done.fail);
12961296
});
1297+
1298+
it('should be able to restyle *marker.fillet*', function(done) {
1299+
var mock = {
1300+
data: [{
1301+
type: 'treemap',
1302+
labels: ['Root', 'A', 'B', 'b'],
1303+
parents: ['', 'Root', 'Root', 'B'],
1304+
text: ['node0', 'node1', 'node2', 'node3'],
1305+
values: [0, 1, 2, 3],
1306+
pathbar: { visible: false }
1307+
}]
1308+
};
1309+
1310+
function _assert(msg, exp) {
1311+
return function() {
1312+
var layer = d3Select(gd).select('.treemaplayer');
1313+
layer.selectAll('.surface').each(function() {
1314+
var surfaces = d3Select(this);
1315+
var path = surfaces[0][0].getAttribute('d');
1316+
expect(path.indexOf('a') !== -1).toEqual(exp);
1317+
});
1318+
};
1319+
}
1320+
1321+
Plotly.newPlot(gd, mock)
1322+
.then(_assert('no arcs', false))
1323+
.then(function() {
1324+
return Plotly.restyle(gd, 'marker.fillet', 10);
1325+
})
1326+
.then(_assert('has arcs', true))
1327+
.then(function() {
1328+
return Plotly.restyle(gd, 'marker.fillet', 0);
1329+
})
1330+
.then(_assert('no arcs', false))
1331+
.then(done, done.fail);
1332+
});
12971333
});
12981334

12991335
describe('Test treemap tweening:', function() {

0 commit comments

Comments
 (0)