Skip to content

Commit

Permalink
adding new tests to check toolbar is rendered properly when showToolb…
Browse files Browse the repository at this point in the history
…ar prop is passed
  • Loading branch information
alisasanib committed Dec 18, 2021
1 parent d091aeb commit e2be163
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/mui-lab/src/DateTimePicker/DateTimePicker.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as React from 'react';
import TextField from '@mui/material/TextField';
import DateTimePicker from '@mui/lab/DateTimePicker';
import { expect } from 'chai';
import { screen } from 'test/utils';
import { createPickerRenderer } from '../internal/pickers/test-utils';

describe('<DateTimePicker />', () => {
Expand All @@ -16,4 +18,17 @@ describe('<DateTimePicker />', () => {
/>,
);
});
it('prop `showToolbar` – renders toolbar in DateTimePicker', () => {
render(
<DateTimePicker
open
showToolbar
onChange={() => {}}
value={null}
renderInput={(params) => <TextField {...params} />}
/>,
);

expect(screen.getByMuiTest('picker-toolbar')).toBeVisible();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@ describe('<MobileDateTimePicker />', () => {
expect(screen.getByMuiTest('datetimepicker-toolbar-day')).to.have.text('Nov 20');
});

it('prop `showToolbar` – renders toolbar in MobileDateTimePicker', () => {
render(
<MobileDateTimePicker
open
showToolbar
onChange={() => {}}
value={adapterToUse.date('2021-11-20T10:01:22.000')}
renderInput={(params) => <TextField {...params} />}
/>,
);

expect(screen.getByMuiTest('picker-toolbar')).toBeVisible();
});

it('can render seconds on view', () => {
render(
<MobileDateTimePicker
Expand Down

0 comments on commit e2be163

Please sign in to comment.