Skip to content

Commit

Permalink
Merge branch 'master' into 5.17.1-doc-update
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan committed May 14, 2024
2 parents fdf95c5 + a2d8659 commit dabd6f0
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions components/theme/__tests__/token.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import theme from '..';
import { render, renderHook } from '../../../tests/utils';
import ConfigProvider from '../../config-provider';
import type { ThemeConfig } from '../../config-provider/context';
import Input from '../../input';
import Row from '../../row';
import Slider from '../../slider';
import genRadius from '../themes/shared/genRadius';

const { useToken } = theme;
Expand Down Expand Up @@ -314,30 +314,24 @@ describe('Theme', () => {
<ConfigProvider
theme={{
components: {
Slider: {
Input: {
colorPrimary: '#00B96B',
algorithm,
},
},
}}
>
<Slider value={5} />
<Input />
</ConfigProvider>
);

const { container, rerender } = render(<Demo />);
expect(container.querySelector('.ant-slider-track')).toHaveStyle({
'background-color': '#91caff',
});
expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#4096ff' });

rerender(<Demo algorithm />);
expect(container.querySelector('.ant-slider-track')).toHaveStyle({
'background-color': '#6ce0a4',
});
expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#20c77c' });

rerender(<Demo algorithm={theme.darkAlgorithm} />);
expect(container.querySelector('.ant-slider-track')).toHaveStyle({
'background-color': '#0e462e',
});
expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#1fb572' });
});
});

0 comments on commit dabd6f0

Please sign in to comment.