tuya-panel-kit
Version:
a functional component library for developing tuya device panels!
49 lines (42 loc) • 3.06 kB
JavaScript
import 'react-native';
import React from 'react';
import renderer from 'react-test-renderer';
import IconFont from '../index';
describe('IconFont Component', () => {
it('basic render', () => {
const component = renderer.create(
<IconFont
size={50 * 0.72}
color="red"
d="M651.642 662.794h-206.84v-196.6c9.557 9.557 21.845 17.577 36.863 24.063 15.018 6.485 31.743 9.728 50.174 9.728 35.497 0 64.338-10.922 86.525-32.766 22.186-21.845 33.279-53.928 33.279-96.252v-188.408c0-24.575-4.266-46.419-12.8-65.534s-19.967-35.497-34.302-49.15c-14.335-13.653-30.89-24.063-49.662-31.23-18.773-7.167-38.399-10.752-58.878-10.752-20.479 0-40.104 3.584-58.878 10.752-18.773 7.168-35.327 17.578-49.662 31.23-14.335 13.653-25.77 30.036-34.302 49.15-8.533 19.114-12.8 40.958-12.8 65.534v30.719h104.444v-26.623c0-17.748 4.95-31.572 14.847-41.471 9.898-9.898 22.698-14.847 38.399-14.847s27.818 4.779 36.351 14.335c8.533 9.557 12.8 22.868 12.8 39.935v171.001c0 14.335-4.608 26.623-13.824 36.863s-20.991 15.36-35.327 15.36c-8.874 0-16.383-1.536-22.527-4.608-6.144-3.072-11.264-6.656-15.36-10.752s-7.338-8.533-9.728-13.311c-2.389-4.779-4.266-8.533-5.632-11.264h-92.156v393.199h298.996v-98.3z"
vFlip={true}
/>
);
expect(component.toJSON()).toMatchSnapshot();
});
it('basic render d = 123', () => {
const component = renderer.create(
<IconFont size={50 * 0.72} color="red" vFlip={true} d={[]} />
);
expect(component.toJSON()).toMatchSnapshot();
});
it('basic render d = undefined', () => {
const component = renderer.create(<IconFont size={50 * 0.72} color="red" vFlip={true} />);
expect(component.toJSON()).toMatchSnapshot();
});
it('IconFont render width viewBox', function() {
const component = renderer.create(
<IconFont
size={24}
hFlip={true}
vFlip={false}
d="M651.642 662.794h-206.84v-196.6c9.557 9.557 21.845 17.577 36.863 24.063 15.018 6.485 31.743 9.728 50.174 9.728 35.497 0 64.338-10.922 86.525-32.766 22.186-21.845 33.279-53.928 33.279-96.252v-188.408c0-24.575-4.266-46.419-12.8-65.534s-19.967-35.497-34.302-49.15c-14.335-13.653-30.89-24.063-49.662-31.23-18.773-7.167-38.399-10.752-58.878-10.752-20.479 0-40.104 3.584-58.878 10.752-18.773 7.168-35.327 17.578-49.662 31.23-14.335 13.653-25.77 30.036-34.302 49.15-8.533 19.114-12.8 40.958-12.8 65.534v30.719h104.444v-26.623c0-17.748 4.95-31.572 14.847-41.471 9.898-9.898 22.698-14.847 38.399-14.847s27.818 4.779 36.351 14.335c8.533 9.557 12.8 22.868 12.8 39.935v171.001c0 14.335-4.608 26.623-13.824 36.863s-20.991 15.36-35.327 15.36c-8.874 0-16.383-1.536-22.527-4.608-6.144-3.072-11.264-6.656-15.36-10.752s-7.338-8.533-9.728-13.311c-2.389-4.779-4.266-8.533-5.632-11.264h-92.156v393.199h298.996v-98.3z"
/>
);
expect(component.toJSON()).toMatchSnapshot();
});
it('IconFont render width name', function() {
const component = renderer.create(<IconFont width={24} height={24} fill="#333" name="power" />);
expect(component.toJSON()).toMatchSnapshot();
});
});