contains(selector)

Returns true if wrapper contains selector. Use any valid avoriaz selector.

Arguments

selector (String|Component): a CSS selector ('#id', '.class-name', 'tag') or a Vue component. See selectors.

Returns

(Boolean): returns true if wrapper contains selector.

Example

Foo.vue

<template lang="html">
    <div>
        <p></p>
    </div>
</template>

<script>
export default {
    name: 'foo'
}
</script>

Foo.spec.js

import { mount } from 'avoriaz';
import Foo from './Foo.vue';

const wrapper = mount(Foo);
expect(wrapper.contains('p')).to.equal(true);

Example with Component

Bar.vue

<template lang="html">
    <div>
        <baz></baz>
    </div>
</template>

<script>
import Baz from './Baz.vue';

export default {
    name: 'bar',
    components: {
        Baz
    }
}
</script>

Baz.vue

<template lang="html">
    <div></div>
</template>

<script>
export default {
    name: 'baz'
}
</script>

Bar.spec.js

import { mount } from 'avoriaz';
import Bar from './Bar.vue';
import Baz from './Baz.vue';

const wrapper = mount(Bar)
expect(wrapper.contains(Baz)).to.equal(true)

results matching ""

    No results matching ""