Skip to content

Commit ccaef04

Browse files
committed
test sankey hoverlabels defined in template
1 parent 644c4e3 commit ccaef04

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Diff for: test/jasmine/tests/sankey_test.js

+53
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,59 @@ describe('sankey tests', function() {
466466
.then(done);
467467
});
468468

469+
it('should show the correct hover labels with the style provided in template', function(done) {
470+
var gd = createGraphDiv();
471+
var mockCopy = Lib.extendDeep({}, mock);
472+
mockCopy.layout.template = {
473+
data: {
474+
sankey: [{
475+
node: {
476+
hoverlabel: {
477+
bgcolor: 'red',
478+
bordercolor: 'blue',
479+
font: {
480+
size: 20,
481+
color: 'black',
482+
family: 'Roboto'
483+
}
484+
}
485+
},
486+
link: {
487+
hoverlabel: {
488+
bgcolor: 'yellow',
489+
bordercolor: 'magenta',
490+
font: {
491+
size: 18,
492+
color: 'green',
493+
family: 'Roboto'
494+
}
495+
}
496+
}
497+
}]
498+
}
499+
};
500+
501+
Plotly.plot(gd, mockCopy)
502+
.then(function() {
503+
_hover(404, 302);
504+
505+
assertLabel(
506+
['Solid', 'incoming flow count: 4', 'outgoing flow count: 3', '447TWh'],
507+
['rgb(255, 0, 0)', 'rgb(0, 0, 255)', 20, 'Roboto', 'rgb(0, 0, 0)']
508+
);
509+
})
510+
.then(function() {
511+
_hover(450, 300);
512+
513+
assertLabel(
514+
['source: Solid', 'target: Industry', '46TWh'],
515+
['rgb(255, 255, 0)', 'rgb(255, 0, 255)', 18, 'Roboto', 'rgb(0, 128, 0)']
516+
);
517+
})
518+
.catch(failTest)
519+
.then(done);
520+
});
521+
469522
it('should show the correct hover labels even if there is no link.label supplied', function(done) {
470523
var gd = createGraphDiv();
471524
var mockCopy = Lib.extendDeep({}, mock);

0 commit comments

Comments
 (0)