mirror of
https://github.com/iconify/iconify.git
synced 2024-12-13 14:13:06 +00:00
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
import { Icon, InlineIcon } from '../../dist/offline';
|
|
import { describe, test, expect } from 'vitest';
|
|
import { render } from '@testing-library/react';
|
|
|
|
const iconData = {
|
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
width: 24,
|
|
height: 24,
|
|
};
|
|
|
|
describe('Creating component', () => {
|
|
test('basic icon', () => {
|
|
const renderResult = render(<Icon icon={iconData} />);
|
|
expect(renderResult.container.innerHTML).toEqual(
|
|
'<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" viewBox="0 0 24 24"><path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"></path></svg>'
|
|
);
|
|
});
|
|
|
|
test('inline icon', () => {
|
|
const renderResult = render(<InlineIcon icon={iconData} />);
|
|
expect(renderResult.container.innerHTML).toEqual(
|
|
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" style="vertical-align: -0.125em;" width="1em" height="1em" viewBox="0 0 24 24"><path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"></path></svg>'
|
|
);
|
|
});
|
|
});
|