import { mount } from '@vue/test-utils'; import { Icon } from '../../offline'; const iconData = { body: '', width: 24, height: 24, }; describe('Dimensions', () => { test('height', () => { const Wrapper = { components: { Icon }, template: ``, data() { return { icon: iconData, }; }, }; const wrapper = mount(Wrapper, {}); const html = wrapper.html(); expect(html).toContain('height="48"'); expect(html).toContain('width="48"'); expect(html).not.toContain('height="1em"'); expect(html).not.toContain('width="1em"'); }); test('width and height', () => { const Wrapper = { components: { Icon }, template: ``, data() { return { icon: iconData, }; }, }; const wrapper = mount(Wrapper, {}); const html = wrapper.html(); expect(html).toContain('height="48"'); expect(html).toContain('width="32"'); expect(html).not.toContain('height="1em"'); expect(html).not.toContain('width="1em"'); }); test('auto', () => { const Wrapper = { components: { Icon }, template: ``, data() { return { icon: iconData, }; }, }; const wrapper = mount(Wrapper, {}); const html = wrapper.html(); expect(html).toContain('height="24"'); expect(html).toContain('width="24"'); expect(html).not.toContain('height="1em"'); expect(html).not.toContain('width="1em"'); }); });