Skip to content

Wrapper.find() does not work in IE11 without polyfill #1223

Closed
@markbrouch

Description

@markbrouch

Version

1.0.0-beta.29

Reproduction link

https://github.com/eddyerburgh/vue-test-utils-karma-example

Steps to reproduce

Using Karma test runner in IE11 environment, run the Counter.spec.js test.

What is expected?

wrapper.find('button') should return a wrapper of the matching element.

What is actually happening?

No match is returned and an error is thrown that trigger must be provided a non-empty wrapper.


This is due to IE11 not supporting Element.matches(). Intead IE11 has the non-standard Element.msMatchesSelector(). MDN has a simple polyfill that should be implemented and solves this problem:

if (!Element.prototype.matches) {
  Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}

I'm happy to open a PR to fix this, I just don't know where the correct place to install this polyfill would be.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions