mirror of
https://github.com/iconify/iconify.git
synced 2024-12-13 14:13:06 +00:00
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
/**
|
|
* @jest-environment jsdom
|
|
*/
|
|
import { mount } from '@vue/test-utils';
|
|
// Link to file
|
|
import { Icon } from '../../dist/offline';
|
|
|
|
const iconData = {
|
|
body:
|
|
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
width: 24,
|
|
height: 24,
|
|
};
|
|
|
|
describe('Creating component', () => {
|
|
test('with wrapper', () => {
|
|
const Wrapper = {
|
|
components: { Icon },
|
|
template: `<Icon :icon='icon' />`,
|
|
data() {
|
|
return {
|
|
icon: iconData,
|
|
};
|
|
},
|
|
};
|
|
|
|
const wrapper = mount(Wrapper, {});
|
|
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(
|
|
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"></path></svg>'
|
|
);
|
|
});
|
|
|
|
test('without wrapper', () => {
|
|
const wrapper = mount(Icon, {
|
|
propsData: {
|
|
icon: iconData,
|
|
},
|
|
});
|
|
|
|
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(
|
|
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"></path></svg>'
|
|
);
|
|
});
|
|
});
|