Skip to content

Commit dacebb7

Browse files
committed
Fixed TypeScript typings after update
1 parent b6d2c63 commit dacebb7

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ clean:
7373

7474
# Lint source files
7575
lint: node_modules
76-
$(shell npm bin)/tslint -p tsconfig.json "{src,tests}/**/*.ts"
76+
$(shell npm bin)/tslint -p tsconfig.json "src/**/*.ts"
77+
$(shell npm bin)/tslint -p tests/tsconfig.json "tests/**/*.ts"
7778

7879
# Execute integration tests
79-
test/integration: node_modules build
80+
test-integration: node_modules build
8081
$(shell npm bin)/karma start tests/karma.integration.conf.ts \
8182
--single-run
8283

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"clean": "make clean",
3535
"lint": "make lint",
3636
"test": "make test",
37-
"test/integration": "make test/integration",
37+
"test:integration": "make test-integration",
3838
"watch": "make watch"
3939
},
4040
"dependencies": {

tests/suites/unit/viewport.spec.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)