is

Deprecation warning

Using is to assert that DOM node or vm matches selector is deprecated and will be removed.

Consider a custom matcher such as those provided in jest-dom. or for DOM element type assertion use native Element.tagName instead.

To keep these tests, a valid replacement for:

  • is('DOM_SELECTOR') is a assertion of wrapper.element.tagName.
  • is('ATTR_NAME') is a truthy assertion of wrapper.attributes('ATTR_NAME').
  • is('CLASS_NAME') is a truthy assertion of wrapper.classes('CLASS_NAME').

When using with findComponent, access the DOM element with findComponent(Comp).element

Assert Wrapper DOM node or vm matches selector.

  • Arguments:

    • {string|Component} selector
  • Returns: {boolean}

  • Example:

import { mount } from '@vue/test-utils'
import Foo from './Foo.vue'

const wrapper = mount(Foo)
expect(wrapper.is('div')).toBe(true)