Skip to content

Commit 3d1fd12

Browse files
committed
Fix jest error.
1 parent a59f43e commit 3d1fd12

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/pagemode.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ describe(theme, () => {
1212
const initStart = 100
1313
const listCount = 1000
1414
const spy = sinon.stub()
15+
16+
let windowScrollTo = window.scrollTo
17+
1518
const wrapper = mount({
1619
template: `
1720
<div id="app" style="width: 300px;">
@@ -48,11 +51,19 @@ describe(theme, () => {
4851
}
4952
},
5053

54+
beforeCreate () {
55+
// Error: Not implemented: window.scrollTo
56+
window.scrollTo = () => {}
57+
},
58+
5159
beforeDestroy () {
5260
spy()
61+
window.scrollTo = windowScrollTo
5362
}
5463
})
5564

65+
66+
5667
it(`[${theme}] check list build success.`, () => {
5768
expect(wrapper.find('.for-item').exists()).toBe(true)
5869
expect(wrapper.find('.for-item-text').exists()).toBe(true)

0 commit comments

Comments
 (0)