Skip to content

Commit b494253

Browse files
committed
add missing tests for new trace type icicle
1 parent 355cafa commit b494253

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

test/jasmine/assets/mock_lists.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var svgMockList = [
3535
['sankey_energy', require('@mocks/sankey_energy.json')],
3636
['sunburst_coffee', require('@mocks/sunburst_coffee.json')],
3737
['treemap_coffee', require('@mocks/treemap_coffee.json')],
38+
['icicle_coffee', require('@mocks/icicle_coffee.json')],
3839
['parcats_bad-displayindex', require('@mocks/parcats_bad-displayindex.json')],
3940
['scattercarpet', require('@mocks/scattercarpet.json')],
4041
['shapes', require('@mocks/shapes.json')],

test/jasmine/tests/plot_api_react_test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,41 @@ describe('Plotly.react and uirevision attributes', function() {
21172117
})
21182118
.then(done, done.fail);
21192119
});
2120+
2121+
it('preserves icicle level changes', function(done) {
2122+
function assertLevel(msg, exp) {
2123+
expect(gd._fullData[0].level).toBe(exp, msg);
2124+
}
2125+
2126+
Plotly.react(gd, [{
2127+
type: 'icicle',
2128+
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
2129+
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve'],
2130+
uirevision: 1
2131+
}])
2132+
.then(function() {
2133+
assertLevel('no set level at start', undefined);
2134+
})
2135+
.then(function() {
2136+
var nodeSeth = d3Select('.slice:nth-child(2)').node();
2137+
mouseEvent('click', 0, 0, {element: nodeSeth});
2138+
})
2139+
.then(function() {
2140+
assertLevel('after clicking on Seth sector', 'Seth');
2141+
})
2142+
.then(function() {
2143+
return Plotly.react(gd, [{
2144+
type: 'icicle',
2145+
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura', 'Joe'],
2146+
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve', 'Seth'],
2147+
uirevision: 1
2148+
}]);
2149+
})
2150+
.then(function() {
2151+
assertLevel('after reacting with new data, but with same uirevision', 'Seth');
2152+
})
2153+
.then(done, done.fail);
2154+
});
21202155
});
21212156

21222157
describe('Test Plotly.react + interactions under uirevision:', function() {

0 commit comments

Comments
 (0)