-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ScrollLock: Covert component to TypeScript (#42303)
* ScrollLock: Covert component to TypeScript * Update CHANGELOG.md * Update CHANGELOG.md
- Loading branch information
Petter Walbø Johnsgård
authored
Jul 14, 2022
1 parent
88e911e
commit cfd9596
Showing
6 changed files
with
98 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { render } from '@testing-library/react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ScrollLock from '..'; | ||
|
||
describe( 'scroll-lock', () => { | ||
const lockingClassName = 'lockscroll'; | ||
|
||
it( 'locks when mounted', () => { | ||
expect( document.documentElement ).not.toHaveClass( lockingClassName ); | ||
render( <ScrollLock /> ); | ||
expect( document.documentElement ).toHaveClass( lockingClassName ); | ||
} ); | ||
|
||
it( 'unlocks when unmounted', () => { | ||
const { unmount } = render( <ScrollLock /> ); | ||
expect( document.documentElement ).toHaveClass( lockingClassName ); | ||
unmount(); | ||
expect( document.documentElement ).not.toHaveClass( lockingClassName ); | ||
} ); | ||
} ); |