chrildren()
Returns a list with all child elements of the Vue component.
Returns
(Wrapper[]
): Returns the content of the computed function or undefined
(if computed function does not exist).
Example
import { mount, mountAsChild } from '@jasoeight/vue-testing';
import { expect } from 'chai';
import Example from './path/to/Example.vue';
describe('Example.vue', () => {
it('has child elements h1 and ul (tested with mount())', () => {
const wrapper = mount(Example);
const children = wrapper.children();
expect(children.length).to.equal(2);
expect(children[0].is('h1')).to.be.true;
expect(children[1].is('ul')).to.be.true;
});
it('has child elements h1 and ul (tested with mountAsChild())', () => {
const wrapper = mountAsChild(Example);
const children = wrapper.children();
expect(children.length).to.equal(2);
expect(children[0].is('h1')).to.be.true;
expect(children[1].is('ul')).to.be.true;
});
});