Selectors

A selector can either be a CSS selector, or a Vue component.

CSS Selectors

The library handles the following CSS selectors:

  • tag selectors (div, foo, bar)
  • class selectors (.foo, .bar)
  • attribute selectors ([foo], [foo="bar"])
  • id selectors (#foo, #bar)

You can also use descendant combinators:

  • direct descendant combinator (div > bar > foo)
  • general descendant combinator (div bar foo)

Vue Components

Vue components are also valid selectors.

The library uses the name property to search the instance tree for matching Vue components.

Example

// Foo.vue

export default{
  name: 'Foo',
};
import Foo from './Foo.vue';
const wrapper = mount(Foo);

expect(wrapper.is(Foo)).to.equal(true);

results matching ""

    No results matching ""