mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
This commit is contained in:
parent
35c49b2bc6
commit
1d6f852160
2 changed files with 2 additions and 8 deletions
|
@ -23,10 +23,7 @@ describe('Scroll to top', () => {
|
|||
Object.defineProperty(globalNode.window, 'scroll', { value: spyScroll });
|
||||
mount(<HookWrapper hook={() => scrollToTop()} />);
|
||||
|
||||
expect(spyScroll).toHaveBeenCalledWith({
|
||||
top: 0,
|
||||
left: 0,
|
||||
});
|
||||
expect(spyScroll).toHaveBeenCalledWith(0, 0);
|
||||
});
|
||||
|
||||
test('scrollTo have been called', () => {
|
||||
|
|
|
@ -10,10 +10,7 @@ export const scrollToTop = () => {
|
|||
useEffect(() => {
|
||||
// trying to use new API - https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo
|
||||
if (window.scroll) {
|
||||
window.scroll({
|
||||
top: 0,
|
||||
left: 0,
|
||||
});
|
||||
window.scroll(0, 0);
|
||||
} else {
|
||||
// just a fallback for older browsers
|
||||
window.scrollTo(0, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue