Skip to content

Commit

Permalink
chore: add bug version & fix test case (#48571)
Browse files Browse the repository at this point in the history
* chore: add bug version

* test: clean up

* test: fix test case

* chore: fix lint

* test: fix test case

* test: fix test case
  • Loading branch information
zombieJ committed Apr 21, 2024
1 parent 3865e8e commit ae155b9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
3 changes: 2 additions & 1 deletion BUG_VERSIONS.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@
"5.13.0": ["https://github.com/ant-design/ant-design/pull/46962"],
"5.14.0": ["https://github.com/ant-design/ant-design/issues/47354"],
"5.15.0": ["https://github.com/ant-design/ant-design/pull/47504#issuecomment-1980459433"],
">= 5.16.0 <= 5.16.1": ["https://github.com/ant-design/ant-design/issues/48200"]
">= 5.16.0 <= 5.16.1": ["https://github.com/ant-design/ant-design/issues/48200"],
"5.16.3": ["https://github.com/ant-design/ant-design/issues/48568"]
}
4 changes: 2 additions & 2 deletions components/form/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ describe('Form', () => {
mark: 'pro_table_render',
render: (_: any, doms: any) => (
<div>
<h1>warning title</h1>
<div className="bamboo">warning title</div>
{doms.input}
{doms.errorList}
{doms.extra}
Expand All @@ -1236,7 +1236,7 @@ describe('Form', () => {
</Form>,
);

expect(container.querySelector('h1')!).toHaveTextContent(/warning title/i);
expect(container.querySelector('.bamboo')!).toHaveTextContent(/warning title/i);
});

it('Form Item element id will auto add form_item prefix if form name is empty and item name is in the black list', async () => {
Expand Down
5 changes: 1 addition & 4 deletions components/notification/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ describe('notification', () => {
expect(document.querySelectorAll('.with-false .ant-notification-notice-close').length).toBe(0);
});

it('style.width could be overrided', async () => {
it('style.width could be override', async () => {
act(() => {
notification.open({
message: 'Notification Title',
Expand All @@ -400,8 +400,5 @@ describe('notification', () => {
});
await awaitPromise();
expect(document.querySelector('.with-style')).toHaveStyle({ width: '600px' });
expect(
document.querySelector('.ant-notification-notice-wrapper:has(.width-style)'),
).toHaveStyle({ width: '' });
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ exports[`Segmented render label with ReactNode 1`] = `
<div
class="ant-segmented-item-label"
>
<h2>
<div
class="little"
>
Monthly
</h2>
</div>
</div>
</label>
</div>
Expand Down
4 changes: 2 additions & 2 deletions components/segmented/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Segmented', () => {
options={[
{ label: 'Daily', value: 'Daily' },
{ label: <div id="weekly">Weekly</div>, value: 'Weekly' },
{ label: <h2>Monthly</h2>, value: 'Monthly' },
{ label: <div className="little">Monthly</div>, value: 'Monthly' },
]}
/>,
);
Expand All @@ -71,7 +71,7 @@ describe('Segmented', () => {
expectMatchChecked(container, [true, false, false]);

expect(container.querySelector('#weekly')?.textContent).toContain('Weekly');
expect(container.querySelectorAll('h2')[0].textContent).toContain('Monthly');
expect(container.querySelector('.little')?.textContent).toContain('Monthly');
});

it('render segmented with defaultValue', () => {
Expand Down
18 changes: 12 additions & 6 deletions components/theme/__tests__/token.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import { Theme } from '@ant-design/cssinjs';
import { Input } from 'antd';

import theme from '..';
import { render, renderHook } from '../../../tests/utils';
import ConfigProvider from '../../config-provider';
import type { ThemeConfig } from '../../config-provider/context';
import Row from '../../row';
import Slider from '../../slider';
import genRadius from '../themes/shared/genRadius';

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

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

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

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

0 comments on commit ae155b9

Please sign in to comment.