chore: add bug version & fix test case (#48571)

* chore: add bug version

* test: clean up

* test: fix test case

* chore: fix lint

* test: fix test case

* test: fix test case
This commit is contained in:
二货爱吃白萝卜 2024-04-21 23:56:41 +08:00 committed by GitHub
parent 3865e8e2ab
commit ae155b97d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 17 deletions

View File

@ -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"]
}

View File

@ -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}
@ -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 () => {

View File

@ -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',
@ -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: '' });
});
});

View File

@ -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>

View File

@ -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' },
]}
/>,
);
@ -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', () => {

View File

@ -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;
@ -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',
});
});
});