File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ import { dom } from '../../src/index' ;
2+
3+ const { pageLock, unLockPage } = dom ;
4+
5+ const recyclerview = document . createElement ( 'div' ) ;
6+ recyclerview . setAttribute ( 'id' , 'recyclerview' ) ;
7+
8+ describe ( 'test lock page' , ( ) => {
9+ afterAll ( ( ) => {
10+ document . body . innerHTML = '' ;
11+ } ) ;
12+ it ( 'should lock page' , ( ) => {
13+ expect . assertions ( 2 ) ;
14+ pageLock ( ) ;
15+ expect ( document . body . style . height ) . toEqual ( '100%' ) ;
16+ expect ( document . body . style . overflow ) . toEqual ( 'hidden' ) ;
17+ } ) ;
18+
19+ it ( 'should lock page in recyclerview' , ( ) => {
20+ document . body . appendChild ( recyclerview ) ;
21+ expect . assertions ( 2 ) ;
22+ pageLock ( ) ;
23+ expect ( recyclerview . style . height ) . toEqual ( '100%' ) ;
24+ expect ( recyclerview . style . overflow ) . toEqual ( 'hidden' ) ;
25+ } ) ;
26+ } ) ;
27+
28+
29+ describe ( 'test unlock page' , ( ) => {
30+ afterAll ( ( ) => {
31+ document . body . innerHTML = '' ;
32+ } ) ;
33+ it ( 'should unlock page' , ( ) => {
34+ expect . assertions ( 2 ) ;
35+ pageLock ( ) ;
36+ expect ( document . body . style . height ) . toEqual ( '100%' ) ;
37+ unLockPage ( ) ;
38+ expect ( document . body . style . height ) . toEqual ( 'auto' ) ;
39+ } ) ;
40+
41+
42+ it ( 'should unlock page in recyclerview' , ( ) => {
43+ document . body . appendChild ( recyclerview ) ;
44+ expect . assertions ( 2 ) ;
45+ pageLock ( ) ;
46+ expect ( recyclerview . style . height ) . toEqual ( '100%' ) ;
47+ unLockPage ( ) ;
48+ expect ( recyclerview . style . height ) . toEqual ( 'auto' ) ;
49+ } ) ;
50+ } ) ;
You can’t perform that action at this time.
0 commit comments