Skip to content

Commit 39a56d3

Browse files
committed
add test
1 parent 9b946fe commit 39a56d3

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

tests/picker.spec.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import KeyCode from '@rc-component/util/lib/KeyCode';
88
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
99
import { resetWarned } from '@rc-component/util/lib/warning';
1010
import React from 'react';
11-
import type { PickerRef } from '../src';
11+
import { PickerPanel, type PickerRef } from '../src';
1212
import type { PanelMode, PickerMode } from '../src/interface';
13+
import momentGenerateConfig from '../src/generate/moment';
1314
import enUS from '../src/locale/en_US';
1415
import zhCN from '../src/locale/zh_CN';
1516
import {
@@ -1371,7 +1372,30 @@ describe('Picker.Basic', () => {
13711372
expect(body).toHaveClass(customClassNames.popupBody);
13721373
expect(body).toHaveStyle(customStyles.popupBody);
13731374
});
1374-
1375+
it('support classNames and styles for panel', () => {
1376+
const customClassNames = {
1377+
popupBody: 'custom-body',
1378+
popupContent: 'custom-content',
1379+
};
1380+
const customStyles = {
1381+
popupBody: { color: 'green' },
1382+
popupContent: { color: 'blue' },
1383+
};
1384+
render(
1385+
<PickerPanel
1386+
classNames={customClassNames}
1387+
styles={customStyles}
1388+
locale={enUS}
1389+
generateConfig={momentGenerateConfig}
1390+
/>,
1391+
);
1392+
const content = document.querySelector('.rc-picker-content');
1393+
const body = document.querySelector('.rc-picker-body');
1394+
expect(content).toHaveClass(customClassNames.popupContent);
1395+
expect(content).toHaveStyle(customStyles.popupContent);
1396+
expect(body).toHaveClass(customClassNames.popupBody);
1397+
expect(body).toHaveStyle(customStyles.popupBody);
1398+
});
13751399
it('showTime config should have format', () => {
13761400
render(
13771401
<DayPicker

0 commit comments

Comments
 (0)