Skip to content

Commit e201a06

Browse files
committed
test: add test case
1 parent 1f652bf commit e201a06

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/picker.spec.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,7 @@ describe('Picker.Basic', () => {
14321432

14331433
it('classNames and styles should support time panel', async () => {
14341434
const testClassNames = {
1435+
root: 'test-root',
14351436
input: 'test-input',
14361437
prefix: 'test-prefix',
14371438
suffix: 'test-suffix',
@@ -1442,6 +1443,7 @@ describe('Picker.Basic', () => {
14421443
};
14431444

14441445
const testStyles = {
1446+
root: { color: 'red' },
14451447
input: { color: 'red' },
14461448
prefix: { color: 'green' },
14471449
suffix: { color: 'blue' },
@@ -1470,15 +1472,20 @@ describe('Picker.Basic', () => {
14701472
generateConfig={momentGenerateConfig}
14711473
/>,
14721474
);
1475+
const root = container.querySelector('.rc-picker');
14731476
const input = container.querySelectorAll('.rc-picker-input input')[0];
14741477
const prefix = container.querySelector('.rc-picker-prefix');
14751478
const suffix = container.querySelector('.rc-picker-suffix');
1479+
1480+
expect(root).toHaveClass(testClassNames.root);
1481+
expect(root).toHaveStyle(testStyles.root);
14761482
expect(input).toHaveClass(testClassNames.input);
14771483
expect(input).toHaveStyle(testStyles.input);
14781484
expect(prefix).toHaveClass(testClassNames.prefix);
14791485
expect(prefix).toHaveStyle(testStyles.prefix);
14801486
expect(suffix).toHaveClass(testClassNames.suffix);
14811487
expect(suffix).toHaveStyle(testStyles.suffix);
1488+
14821489
const { container: panel } = render(
14831490
<PickerPanel
14841491
classNames={testPopupClassNames}
@@ -1496,6 +1503,14 @@ describe('Picker.Basic', () => {
14961503
expect(item).toHaveStyle(testPopupStyles.item);
14971504
});
14981505

1506+
it('rootClassName', () => {
1507+
render(<DayPicker rootClassName="bamboo" open />);
1508+
1509+
expect(document.body.querySelectorAll('.bamboo')).toHaveLength(2);
1510+
expect(document.body.querySelector('.rc-picker')).toHaveClass('bamboo');
1511+
expect(document.body.querySelector('.rc-picker-dropdown')).toHaveClass('bamboo');
1512+
});
1513+
14991514
it('showTime config should have format', () => {
15001515
render(
15011516
<DayPicker

0 commit comments

Comments
 (0)