Skip to content

Commit c43873a

Browse files
committed
sankey: test multi-dimensional (node|link).customdata in hovertemplate
1 parent 63ef3e9 commit c43873a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/jasmine/tests/sankey_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,9 @@ describe('sankey tests', function() {
817817
var gd = createGraphDiv();
818818
var mockCopy = Lib.extendDeep({}, mock);
819819
mockCopy.data[0].node.customdata = [];
820-
mockCopy.data[0].node.customdata[4] = 'nodeCustomdata';
820+
mockCopy.data[0].node.customdata[4] = ['nodeCustomdata0', 'nodeCustomdata1'];
821821
mockCopy.data[0].link.customdata = [];
822-
mockCopy.data[0].link.customdata[61] = 'linkCustomdata';
822+
mockCopy.data[0].link.customdata[61] = ['linkCustomdata0', 'linkCustomdata1'];
823823

824824
Plotly.plot(gd, mockCopy).then(function() {
825825
_hover(404, 302);
@@ -840,23 +840,23 @@ describe('sankey tests', function() {
840840
// Test (node|link).hovertemplate
841841
.then(function() {
842842
return Plotly.restyle(gd, {
843-
'node.hovertemplate': 'hovertemplate<br>%{value}<br>%{value:0.2f}<br>%{customdata}<extra>%{fullData.name}</extra>',
844-
'link.hovertemplate': 'hovertemplate<br>source: %{source.label}<br>target: %{target.label}<br>size: %{value:0.0f}TWh<br>%{customdata}<extra>%{fullData.name}</extra>'
843+
'node.hovertemplate': 'hovertemplate<br>%{value}<br>%{value:0.2f}<br>%{customdata[0]}/%{customdata[1]}<extra>%{fullData.name}</extra>',
844+
'link.hovertemplate': 'hovertemplate<br>source: %{source.label}<br>target: %{target.label}<br>size: %{value:0.0f}TWh<br>%{customdata[1]}<extra>%{fullData.name}</extra>'
845845
});
846846
})
847847
.then(function() {
848848
_hover(404, 302);
849849

850850
assertLabel(
851-
[ 'hovertemplate', '447TWh', '447.48', 'nodeCustomdata', 'trace 0'],
851+
[ 'hovertemplate', '447TWh', '447.48', 'nodeCustomdata0/nodeCustomdata1', 'trace 0'],
852852
['rgb(148, 103, 189)', 'rgb(255, 255, 255)', 13, 'Arial', 'rgb(255, 255, 255)']
853853
);
854854
})
855855
.then(function() {
856856
_hover(450, 300);
857857

858858
assertLabel(
859-
['hovertemplate', 'source: Solid', 'target: Industry', 'size: 46TWh', 'linkCustomdata', 'trace 0'],
859+
['hovertemplate', 'source: Solid', 'target: Industry', 'size: 46TWh', 'linkCustomdata1', 'trace 0'],
860860
['rgb(0, 0, 96)', 'rgb(255, 255, 255)', 13, 'Arial', 'rgb(255, 255, 255)']
861861
);
862862
})

0 commit comments

Comments
 (0)