Skip to content

Commit

Permalink
fix tests affected by new Backdrop
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Jul 26, 2022
1 parent ce1b762 commit 9f4b26f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 3 additions & 4 deletions components/src/components/molecules/Backdrop/Backdrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ export const Backdrop = ({
if (typeof window !== 'undefined' && open) {
document.body.style.position = ''
document.body.style.top = ''
if (window.scroll)
window.scroll({
top,
})
window.scroll({
top,
})
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
4 changes: 3 additions & 1 deletion components/src/components/molecules/Modal/Modal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { ThemeProvider } from 'styled-components'

import { cleanup, render, screen, waitFor } from '@/test'

import { Modal } from './Modal'
import { lightTheme } from '@/src/tokens'
import { Modal } from './Modal'

window.scroll = jest.fn()

describe('<Modal />', () => {
afterEach(cleanup)
Expand Down
2 changes: 2 additions & 0 deletions components/src/components/organisms/Dialog/Dialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { cleanup, render, screen, userEvent, waitFor } from '@/test'
import { Dialog } from './Dialog'
import { lightTheme } from '@/src/tokens'

window.scroll = jest.fn()

describe('<Modal />', () => {
afterEach(cleanup)

Expand Down
2 changes: 2 additions & 0 deletions components/src/components/organisms/Toast/Toast.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { cleanup, render, screen, userEvent, waitFor } from '@/test'
import { Toast } from './Toast'
import { lightTheme } from '@/src/tokens'

window.scroll = jest.fn()

describe('<Toast />', () => {
afterEach(cleanup)

Expand Down

0 comments on commit 9f4b26f

Please sign in to comment.