@@ -54,7 +54,7 @@ describe("Viewport", () => {
5454
5555 /* Hack: Internet Explorer doesn't initialize the document for an empty
5656 iframe, so we have to do it by ourselves, see https://bit.ly/2GaF6Iw */
57- context . contentDocument . write ( "<body></body>" )
57+ context . contentDocument ! . write ( "<body></body>" )
5858 } )
5959
6060 /* Detach context */
@@ -180,26 +180,26 @@ describe("Viewport", () => {
180180 it ( "should set horizontal offset" , ( ) => {
181181 const viewport = new Viewport ( config , window )
182182 const x = chance . integer ( { min : 10 , max : 100 } )
183- context . contentDocument . body . style . width =
184- `${ context . contentWindow . innerWidth + x } px`
185- context . contentDocument . body . style . height =
186- `${ context . contentWindow . innerHeight } px`
183+ context . contentDocument ! . body . style . width =
184+ `${ context . contentWindow ! . innerWidth + x } px`
185+ context . contentDocument ! . body . style . height =
186+ `${ context . contentWindow ! . innerHeight } px`
187187 viewport . offset ( x )
188- expect ( viewport . context . contentWindow . pageXOffset ) . toEqual ( x )
188+ expect ( viewport . context . contentWindow ! . pageXOffset ) . toEqual ( x )
189189 } )
190190
191191 /* Test: should set horizontal and vertical offset */
192192 it ( "should set horizontal and vertical offset" , ( ) => {
193193 const viewport = new Viewport ( config , window )
194194 const x = chance . integer ( { min : 10 , max : 100 } )
195195 const y = chance . integer ( { min : 10 , max : 100 } )
196- context . contentDocument . body . style . width =
197- `${ context . contentWindow . innerWidth + x } px`
198- context . contentDocument . body . style . height =
199- `${ context . contentWindow . innerHeight + y } px`
196+ context . contentDocument ! . body . style . width =
197+ `${ context . contentWindow ! . innerWidth + x } px`
198+ context . contentDocument ! . body . style . height =
199+ `${ context . contentWindow ! . innerHeight + y } px`
200200 viewport . offset ( x , y )
201- expect ( viewport . context . contentWindow . pageXOffset ) . toEqual ( x )
202- expect ( viewport . context . contentWindow . pageYOffset ) . toEqual ( y )
201+ expect ( viewport . context . contentWindow ! . pageXOffset ) . toEqual ( x )
202+ expect ( viewport . context . contentWindow ! . pageYOffset ) . toEqual ( y )
203203 } )
204204 } )
205205
@@ -237,11 +237,11 @@ describe("Viewport", () => {
237237
238238 /* Test: should force layout */
239239 it ( "should force layout" , ( ) => {
240- spyOn ( context . contentDocument . body , "getBoundingClientRect" )
240+ spyOn ( context . contentDocument ! . body , "getBoundingClientRect" )
241241 const viewport = new Viewport ( config , window )
242242 const width = chance . integer ( { min : 100 , max : 400 } )
243243 viewport . set ( width )
244- expect ( context . contentDocument . body . getBoundingClientRect )
244+ expect ( context . contentDocument ! . body . getBoundingClientRect )
245245 . toHaveBeenCalled ( )
246246 } )
247247
@@ -291,14 +291,14 @@ describe("Viewport", () => {
291291 const viewport = new Viewport ( config , window )
292292 const x = chance . integer ( { min : 10 , max : 100 } )
293293 const y = chance . integer ( { min : 10 , max : 100 } )
294- context . contentDocument . body . style . width =
295- `${ context . contentWindow . innerWidth + x } `
296- context . contentDocument . body . style . height =
297- `${ context . contentWindow . innerHeight + y } `
294+ context . contentDocument ! . body . style . width =
295+ `${ context . contentWindow ! . innerWidth + x } `
296+ context . contentDocument ! . body . style . height =
297+ `${ context . contentWindow ! . innerHeight + y } `
298298 viewport . offset ( x , y )
299299 viewport . reset ( )
300- expect ( viewport . context . contentWindow . pageXOffset ) . toEqual ( 0 )
301- expect ( viewport . context . contentWindow . pageYOffset ) . toEqual ( 0 )
300+ expect ( viewport . context . contentWindow ! . pageXOffset ) . toEqual ( 0 )
301+ expect ( viewport . context . contentWindow ! . pageYOffset ) . toEqual ( 0 )
302302 } )
303303
304304 /* Test: should reset width and height */
@@ -314,10 +314,10 @@ describe("Viewport", () => {
314314
315315 /* Test: should force layout */
316316 it ( "should force layout" , ( ) => {
317- spyOn ( context . contentDocument . body , "getBoundingClientRect" )
317+ spyOn ( context . contentDocument ! . body , "getBoundingClientRect" )
318318 const viewport = new Viewport ( config , window )
319319 viewport . reset ( )
320- expect ( context . contentDocument . body . getBoundingClientRect )
320+ expect ( context . contentDocument ! . body . getBoundingClientRect )
321321 . toHaveBeenCalled ( )
322322 } )
323323 } )
0 commit comments