2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-15 14:50:47 +00:00
iconify/components/vue/tests/offline/10-empty-test.ts

49 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-05-05 16:24:26 +00:00
import { mount } from '@vue/test-utils';
// Import from alias
import { Icon } from '../../offline';
import { emptyString } from '../empty';
2021-05-05 16:24:26 +00:00
describe('Empty icon', () => {
test('basic test', () => {
const wrapper = mount(Icon, {
props: {},
});
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(emptyString);
2021-05-05 16:24:26 +00:00
});
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, '')).toBe(
2021-05-05 16:24:26 +00:00
'<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, '')).toBe('icon');
2021-05-05 16:24:26 +00:00
});
test('with multiple childen', () => {
const Wrapper = {
components: { Icon },
2022-01-11 10:37:20 +00:00
template: `<Icon><i class="fa fa-home" />Home icon</Icon>`,
2021-05-05 16:24:26 +00:00
};
const wrapper = mount(Wrapper, {});
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(
2022-01-11 10:37:20 +00:00
'<i class="fa fa-home"></i>Home icon'
2021-05-05 16:24:26 +00:00
);
});
});