html()
Returns the html of the Wrapper element.
Returns
(String
): Returns the html as string.
Example
import { mount, mountAsChild } from '@jasoeight/vue-testing';
import { expect } from 'chai';
import Example from './path/to/Example.vue';
describe('Example.vue', () => {
it('has a valid h1 html (tested with mount())', () => {
const wrapper = mount(Example, {
propsData: {
firstname: 'John',
lastname: 'Doe'
}
});
expect(wrapper.find('h1')[0].html()).to.equal('<h1 style="color: red;">John Doe</h1>');
});
it('has a valid h1 html (tested with mountAsChild())', () => {
const wrapper = mountAsChild(Example, {
props: {
firstname: 'John',
lastname: 'Doe'
}
});
expect(wrapper.find('h1')[0].html()).to.equal('<h1 style="color: red;">John Doe</h1>');
});
});