/** * @jest-environment jsdom */ import { mount } from '@vue/test-utils'; import { Icon, addIcon, addCollection } from '../../offline'; const iconData = { body: '', width: 24, height: 24, }; describe('Using storage', () => { test('using storage', () => { addIcon('test-icon', iconData); const Wrapper = { components: { Icon }, template: ``, }; const wrapper = mount(Wrapper, {}); expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe( '' ); }); test('using storage with icon set', () => { const iconSet = { prefix: 'mdi-light', icons: { account: { body: '', }, home: { body: '', }, }, width: 24, height: 24, }; addCollection(iconSet); const Wrapper = { components: { Icon }, template: ``, data() { return { icon: 'mdi-light:account', }; }, }; const wrapper = mount(Wrapper, {}); expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe( '' ); }); test('using storage with icon set with custom prefix', () => { const iconSet = { prefix: 'mdi-light', icons: { 'account-alert': { body: '', }, 'link': { body: '', }, }, width: 24, height: 24, }; addCollection(iconSet, 'custom-'); const Wrapper = { components: { Icon }, template: ``, }; const wrapper = mount(Wrapper, {}); expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe( '' ); }); test('missing icon from storage', () => { const Wrapper = { components: { Icon }, template: ``, }; const wrapper = mount(Wrapper, {}); expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(''); }); });