Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/test-utils/src/mount.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { throwIfInstancesThrew, addGlobalErrorHandler } from './error'
import { mergeOptions } from 'shared/merge-options'
import config from './config'
import warnIfNoWindow from './warn-if-no-window'
import polyfill from './polyfill'
import createWrapper from './create-wrapper'
import createLocalVue from './create-local-vue'
import { validateOptions } from 'shared/validate-options'
Expand All @@ -15,6 +16,8 @@ Vue.config.devtools = false
export default function mount(component, options = {}) {
warnIfNoWindow()

polyfill()

addGlobalErrorHandler(Vue)

const _Vue = createLocalVue(options.localVue)
Expand Down
9 changes: 9 additions & 0 deletions packages/test-utils/src/polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function polyfill() {
// Polyfill `Element.matches()` for IE and older versions of Chrome:
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
if (!Element.prototype.matches) {
Element.prototype.matches =
Element.prototype.msMatchesSelector ||
Element.prototype.webkitMatchesSelector
}
}