Skip to content

Commit 363b1c4

Browse files
committed
add jasmine test
1 parent f97300e commit 363b1c4

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/jasmine/tests/legend_test.js

+43
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,49 @@ describe('legend interaction', function() {
17821782
});
17831783
});
17841784

1785+
describe('legendgroup visibility case of groupclick: "toggleitem"', function() {
1786+
beforeEach(function(done) {
1787+
Plotly.newPlot(gd, [{
1788+
x: [1, 2],
1789+
y: [3, 4],
1790+
visible: false
1791+
}, {
1792+
x: [1, 2, 3, 4],
1793+
y: [0, 1, 2, 3],
1794+
legendgroup: 'foo'
1795+
}, {
1796+
x: [1, 2, 3, 4],
1797+
y: [1, 3, 2, 4],
1798+
}, {
1799+
x: [1, 2, 3, 4],
1800+
y: [1, 3, 2, 4],
1801+
legendgroup: 'foo'
1802+
}], {
1803+
legend: {
1804+
groupclick: 'toggleitem'
1805+
}
1806+
}).then(done);
1807+
});
1808+
1809+
it('toggles visibilities', function(done) {
1810+
Promise.resolve()
1811+
.then(assertVisible([false, true, true, true]))
1812+
.then(click(0))
1813+
.then(assertVisible([false, 'legendonly', true, true]))
1814+
.then(click(0))
1815+
.then(assertVisible([false, true, true, true]))
1816+
.then(click(1))
1817+
.then(assertVisible([false, true, true, 'legendonly']))
1818+
.then(click(1))
1819+
.then(assertVisible([false, true, true, true]))
1820+
.then(click(2))
1821+
.then(assertVisible([false, true, 'legendonly', true]))
1822+
.then(click(2))
1823+
.then(assertVisible([false, true, true, true]))
1824+
.then(done, done.fail);
1825+
});
1826+
});
1827+
17851828
describe('legend visibility toggles with groupby', function() {
17861829
beforeEach(function(done) {
17871830
Plotly.newPlot(gd, [{

0 commit comments

Comments
 (0)