Skip to content

Commit 9b6baa8

Browse files
committed
test: legend scrollbar keeps position after toggle
1 parent 8f05316 commit 9b6baa8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/jasmine/tests/legend_scroll_test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ describe('The legend', function() {
7979
'translate(0, ' + finalDataScroll + ')');
8080
});
8181

82+
it('should keep the scrollbar position after a toggle event', function() {
83+
var scrollBox = legend.getElementsByClassName('scrollbox')[0],
84+
toggle = legend.getElementsByClassName('legendtoggle')[0],
85+
wheelDeltaY = 100;
86+
87+
legend.dispatchEvent(scrollTo(wheelDeltaY));
88+
var dataScroll = scrollBox.getAttribute('data-scroll');
89+
90+
toggle.dispatchEvent(new MouseEvent('click'));
91+
expect(+toggle.parentNode.style.opacity).toBeLessThan(1);
92+
expect(scrollBox.getAttribute('data-scroll')).toBe(dataScroll);
93+
expect(scrollBox.getAttribute('transform')).toBe(
94+
'translate(0, ' + dataScroll + ')');
95+
});
96+
8297
it('should constrain scrolling to the contents', function() {
8398
var scrollBox = legend.getElementsByClassName('scrollbox')[0];
8499

0 commit comments

Comments
 (0)