Skip to content

Commit 1860826

Browse files
committed
improve sunburst texttemplate tests - drop the comment for a fixed treemap hover item from fx
1 parent 4c7a092 commit 1860826

File tree

2 files changed

+82
-14
lines changed

2 files changed

+82
-14
lines changed

src/traces/sunburst/fx.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,6 @@ module.exports = function attachFxHandlers(sliceTop, entry, gd, cd, opts) {
285285

286286
Fx.loneUnhover(fullLayoutNow._hoverlayer.node());
287287
Registry.call('animate', gd, frame, animOpts);
288-
/*
289-
.then(function() {
290-
// TODO: fixup hover position
291-
onMouseOver(pt);
292-
});
293-
*/
294288
};
295289

296290
sliceTop.on('mouseover', onMouseOver);

test/jasmine/tests/sunburst_test.js

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,16 +1332,90 @@ describe('Test sunburst interactions edge cases', function() {
13321332
});
13331333
});
13341334

1335-
describe('Test sunburst texttemplate:', function() {
1335+
describe('Test sunburst texttemplate without `values` should work:', function() {
13361336
checkTextTemplate([{
13371337
type: 'sunburst',
1338-
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Esther'],
1339-
values: [11, 12, 13, 14, 15],
1340-
text: ['1', '2', '3', '4', '5'],
1341-
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth' ]
1338+
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
1339+
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve' ],
1340+
text: ['sixty-five', 'fourteen', 'twelve', 'ten', 'two', 'six', 'six', 'one', 'four']
13421341
}], 'g.slicetext', [
1343-
['txt: %{label}', ['txt: Eve', 'txt: Cain', 'txt: Seth', 'txt: Enos', 'txt: Esther']],
1344-
[['txt: %{label}', '%{text}', 'value: %{value}'], ['txt: Eve', '2', 'value: 13', '', '']],
1345-
['%{color}', ['rgba(0,0,0,0)', '#1f77b4', '#ff7f0e', '#1f77b4', '#1f77b4']]
1342+
['color: %{color}', ['color: rgba(0,0,0,0)', 'color: #1f77b4', 'color: #ff7f0e', 'color: #2ca02c', 'color: #d62728', 'color: #9467bd', 'color: #ff7f0e', 'color: #ff7f0e', 'color: #d62728']],
1343+
['label: %{label}', ['label: Eve', 'label: Cain', 'label: Seth', 'label: Enos', 'label: Noam', 'label: Abel', 'label: Awan', 'label: Enoch', 'label: Azura']],
1344+
['text: %{text}', ['text: sixty-five', 'text: fourteen', 'text: twelve', 'text: ten', 'text: two', 'text: six', 'text: six', 'text: one', 'text: four']],
1345+
['%{percentRoot} of %{root}', ['100% of Eve', '33% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve']],
1346+
['%{percentEntry} of %{entry}', ['100% of Eve', '33% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve']],
1347+
['%{percentParent} of %{parent}', [
1348+
'%{percentParent} of %{parent}', // TODO: what should be printed for the parent of root?
1349+
'100% of Seth', '33% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '17% of Eve', '50% of Seth', '100% of Awan'
1350+
]],
1351+
[
1352+
[
1353+
'label: %{label}',
1354+
'text: %{text}',
1355+
'value: %{value}',
1356+
'%{percentRoot} of %{root}',
1357+
'%{percentEntry} of %{entry}',
1358+
'%{percentParent} of %{parent}',
1359+
'%{percentParent} of %{parent}',
1360+
'%{percentParent} of %{parent}',
1361+
'color: %{color}'
1362+
],
1363+
[
1364+
'label: Eve',
1365+
'text: fourteen',
1366+
'value: %{value}', // N.B. there is no `values` array
1367+
'17% of Eve',
1368+
'17% of Eve',
1369+
'17% of Eve',
1370+
'17% of Eve',
1371+
'100% of Awan',
1372+
'color: #9467bd'
1373+
]
1374+
]
1375+
]);
1376+
});
1377+
1378+
describe('Test sunburst texttemplate with `values` should work:', function() {
1379+
checkTextTemplate([{
1380+
type: 'sunburst',
1381+
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
1382+
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve' ],
1383+
values: [65, 14, 12, 10, 2, 6, 6, 1, 4],
1384+
text: ['sixty-five', 'fourteen', 'twelve', 'ten', 'two', 'six', 'six', 'one', 'four']
1385+
}], 'g.slicetext', [
1386+
['color: %{color}', ['color: rgba(0,0,0,0)', 'color: #1f77b4', 'color: #ff7f0e', 'color: #2ca02c', 'color: #d62728', 'color: #9467bd', 'color: #ff7f0e', 'color: #ff7f0e', 'color: #d62728']],
1387+
['label: %{label}', ['label: Eve', 'label: Cain', 'label: Seth', 'label: Enos', 'label: Noam', 'label: Abel', 'label: Awan', 'label: Enoch', 'label: Azura']],
1388+
['value: %{value}', ['value: 65', 'value: 14', 'value: 12', 'value: 10', 'value: 2', 'value: 6', 'value: 6', 'value: 1', 'value: 4']],
1389+
['text: %{text}', ['text: sixty-five', 'text: fourteen', 'text: twelve', 'text: ten', 'text: two', 'text: six', 'text: six', 'text: one', 'text: four']],
1390+
['%{percentRoot} of %{root}', ['100% of Eve', '22% of Eve', '18% of Eve', '9% of Eve', '9% of Eve', '6% of Eve', '15% of Eve', '3% of Eve', '2% of Eve']],
1391+
['%{percentEntry} of %{entry}', ['100% of Eve', '22% of Eve', '18% of Eve', '9% of Eve', '9% of Eve', '6% of Eve', '15% of Eve', '3% of Eve', '2% of Eve']],
1392+
['%{percentParent} of %{parent}', [
1393+
'%{percentParent} of %{parent}', // TODO: what should be printed for the parent of root?
1394+
'83% of Seth', '22% of Eve', '18% of Eve', '9% of Eve', '9% of Eve', '6% of Eve', '17% of Seth', '17% of Awan'
1395+
]],
1396+
[
1397+
[
1398+
'label: %{label}',
1399+
'text: %{text}',
1400+
'value: %{value}',
1401+
'%{percentRoot} of %{root}',
1402+
'%{percentEntry} of %{entry}',
1403+
'%{percentParent} of %{parent}',
1404+
'%{percentParent} of %{parent}',
1405+
'%{percentParent} of %{parent}',
1406+
'color: %{color}'
1407+
],
1408+
[
1409+
'label: Eve',
1410+
'text: fourteen',
1411+
'value: 12',
1412+
'9% of Eve',
1413+
'15% of Eve',
1414+
'3% of Eve',
1415+
'6% of Eve',
1416+
'17% of Awan',
1417+
'color: #9467bd'
1418+
]
1419+
]
13461420
]);
13471421
});

0 commit comments

Comments
 (0)