hasStyle(style, value)

Checks if wrapper has a style with value

Arguments

style (String): The name of the style. value (String): The expected value of the style.

Returns

(Boolean): Whether the Wrapper element has a style with the expected value or not.

Example

Example Component

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

describe('Example.vue', () => {
    it('has h1 with the style with "color: red" (tested with mount())', () => {
        const wrapper = mount(Example);
        expect(wrapper.find('h1')[0].hasStyle('color', 'red')).to.be.true;
    });

    it('has h1 with the style with "color: red" (tested with mountAsChild())', () => {
        const wrapper = mountAsChild(Example);
        expect(wrapper.find('h1')[0].hasStyle('color', 'red')).to.be.true;
    });
});

results matching ""

    No results matching ""