Skip to content

Commit

Permalink
test(icon): add unit test (#2884)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Jan 26, 2024
1 parent 855ffd2 commit cad8128
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/packages/__VUE/icon/__tests__/index.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { mount } from '@vue/test-utils';
import { Add, IconFont } from '@nutui/icons-vue';

test('Icon: svg color width height', async () => {
const wrapper = mount(() => {
return <Add color="pink" width={30} height={30} />;
});

const svg = wrapper.find('.nut-icon');
expect(svg.classes()).toContain('nut-icon-add');
expect(svg.attributes('style')).toContain('color: pink');
expect(svg.attributes('style')).toContain('height: 30px');
expect(svg.attributes('style')).toContain('width: 30px');
});

test('Icon: icofnont color width height', async () => {
const wrapper = mount(() => {
return <IconFont name="add" color="pink" width={30} height={30} />;
});

const svg = wrapper.find('.nut-icon');
expect(svg.classes()).toContain('nut-icon-add');
expect(svg.attributes('style')).toContain('color: pink');
expect(svg.attributes('style')).toContain('height: 30px');
expect(svg.attributes('style')).toContain('width: 30px');
});

0 comments on commit cad8128

Please sign in to comment.