From f4175ffaa17897b58babb94574bccf1ee8165198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Go=CC=88khan=20O=CC=88ztu=CC=88rk?= Date: Tue, 23 Aug 2022 10:44:51 +0300 Subject: [PATCH] test: writes test for icon component --- .../Icon/__snapshots__/icon.spec.ts.snap | 15 ++++++++++ src/components/Icon/icon.spec.ts | 28 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/components/Icon/__snapshots__/icon.spec.ts.snap diff --git a/src/components/Icon/__snapshots__/icon.spec.ts.snap b/src/components/Icon/__snapshots__/icon.spec.ts.snap new file mode 100644 index 0000000..0989904 --- /dev/null +++ b/src/components/Icon/__snapshots__/icon.spec.ts.snap @@ -0,0 +1,15 @@ +// Vitest Snapshot v1 + +exports[`Icon > renders properly 1`] = ` + +`; diff --git a/src/components/Icon/icon.spec.ts b/src/components/Icon/icon.spec.ts index e69de29..f563e87 100644 --- a/src/components/Icon/icon.spec.ts +++ b/src/components/Icon/icon.spec.ts @@ -0,0 +1,28 @@ +import { describe, it, expect } from 'vitest'; + +import { mount } from '@vue/test-utils'; +import Icon from './Icon.vue'; + +describe('Icon', () => { + it('renders properly', () => { + const wrapper = mount(Icon, { + props: { + name: 'AdjustmentsIcon', + size: '24', + color: 'rgb(255, 255, 255)', + kind: 'solid', + }, + }); + expect(wrapper.exists()).toBe(true); + expect(wrapper.find('svg').exists()).toBe(true); + expect(wrapper.find('svg').element.getAttribute('aria-hidden')).toBe( + 'true' + ); + expect(wrapper.find('svg').element.getAttribute('style')).toBe( + 'color: rgb(255, 255, 255);' + ); + expect(wrapper.find('svg').element.getAttribute('fill')).toBe( + 'currentColor' + ); + }); +});