is(selector)

Checks if the node matches the selector-

Arguments

selector (String|VueComponent): see Selectors

Returns

(Boolean): Whether the Wrapper matches the selector or not.

Example

CSS Selector

Example Component

import { mount, mountAsChild } from '@jasoeight/vue-testing';
import { expect } from 'chai';
import Example from './path/to/Example.vue';

describe('Example.vue', () => {
    it('renders wrapping <div> element (tested with mount())', () => {
        const wrapper = mount(Example);
        expect(wrapper.is('div')).to.be.true;
    });

    it('renders wrapping <div> element (tested with mountAsChild())', () => {
        const wrapper = mountAsChild(Example);
        expect(wrapper.is('div')).to.be.true;
    });
});

VueComponent Selector

Example Component

import { mount, mountAsChild } from '@jasoeight/vue-testing';
import { expect } from 'chai';
import Example from './path/to/Example.vue';

describe('Example.vue', () => {
    it('is example component (tested with mount()', () => {
        const wrapper = mount(Example);
        expect(wrapper.is({ name: 'example' })).to.be.true;
    });

    it('is example component (tested with mountAsChild()', () => {
        const wrapper = mountAsChild(Example);
        expect(wrapper.is({ name: 'example' })).to.be.true;
    });
});

results matching ""

    No results matching ""