2
0
mirror of https://github.com/iconify/iconify.git synced 2024-10-23 17:12:03 +00:00
iconify/packages/vue/tests/iconify/10-empty.test.js
2021-05-06 11:21:39 +03:00

47 lines
1.1 KiB
JavaScript

import { mount } from '@vue/test-utils';
import { Icon } from '../../dist/iconify';
describe('Empty icon', () => {
test('basic test', () => {
const wrapper = mount(Icon, {
props: {},
});
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toEqual('<!---->');
});
test('with child node', () => {
const Wrapper = {
components: { Icon },
template: `<Icon><i class="fa fa-home" /></Icon>`,
};
const wrapper = mount(Wrapper, {});
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toEqual(
'<i class="fa fa-home"></i>'
);
});
test('with text child node', () => {
const Wrapper = {
components: { Icon },
template: `<Icon>icon</Icon>`,
};
const wrapper = mount(Wrapper, {});
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toEqual('icon');
});
test('with multiple childen', () => {
const Wrapper = {
components: { Icon },
template: `<Icon><i class="fa fa-home" /> Home icon</Icon>`,
};
const wrapper = mount(Wrapper, {});
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toEqual(
'<i class="fa fa-home"></i> Home icon'
);
});
});