mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
update test case
This commit is contained in:
parent
1cee617a9d
commit
ae9aabb1ac
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render } from 'enzyme';
|
import { render } from 'enzyme';
|
||||||
import Icon from '..';
|
import Icon from '..';
|
||||||
|
import { getThemeFromTypeName, withThemeSuffix } from '../utils';
|
||||||
|
|
||||||
describe('Icon', () => {
|
describe('Icon', () => {
|
||||||
it('should render to a <i class="xxx"><svg>...</svg></i>', () => {
|
it('should render to a <i class="xxx"><svg>...</svg></i>', () => {
|
||||||
@ -148,3 +149,33 @@ describe('Icon.createFromIconfontCN()', () => {
|
|||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('utils', () => {
|
||||||
|
it('getThemeFromTypeName() should work', () => {
|
||||||
|
const testCases = ['check-circle', 'check-circle-o', 'check-circle-fill', 'check-circle-twotone'];
|
||||||
|
const result = testCases.map(type => getThemeFromTypeName(type));
|
||||||
|
expect(result).toEqual(
|
||||||
|
[null, 'outlined', 'filled', 'twoTone']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('withThemeSuffix() should work', () => {
|
||||||
|
const testCases = [
|
||||||
|
{ type: 'home', theme: 'filled' },
|
||||||
|
{ type: 'home', theme: 'outlined' },
|
||||||
|
{ type: 'home', theme: 'twoTone' },
|
||||||
|
{ type: 'home', theme: 'This-is-the-secret' },
|
||||||
|
{ type: 'home-o', theme: 'filled' },
|
||||||
|
{ type: 'home-fill', theme: 'outlined' },
|
||||||
|
{ type: 'home-o', theme: 'twoTone' },
|
||||||
|
{ type: 'home-o', theme: 'This-is-the-secret' },
|
||||||
|
];
|
||||||
|
const result = testCases.map(({ type, theme }) => withThemeSuffix(type, theme));
|
||||||
|
expect(result).toEqual(
|
||||||
|
[
|
||||||
|
'home-fill', 'home-o', 'home-twotone', 'home',
|
||||||
|
'home-o', 'home-fill', 'home-o', 'home-o',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user