-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DatePicker] Migrate YearPicker to emotion #25928
Changes from 1 commit
aec7ba5
f004433
0118cfe
3dc6f41
f9f7838
aff64ac
2058f10
8ba37a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,21 @@ | ||
import * as React from 'react'; | ||
import { spy } from 'sinon'; | ||
import { expect } from 'chai'; | ||
import { getClasses, createMount, fireEvent, screen, describeConformance } from 'test/utils'; | ||
import { createMount, fireEvent, screen, describeConformanceV5 } from 'test/utils'; | ||
import LocalizationProvider from '@material-ui/lab/LocalizationProvider'; | ||
import AdapterDateFns from '@material-ui/lab/AdapterDateFns'; | ||
import YearPicker from '@material-ui/lab/YearPicker'; | ||
import YearPicker, { yearPickersClasses as classes } from '@material-ui/lab/YearPicker'; | ||
import { adapterToUse, createPickerRender } from '../internal/pickers/test-utils'; | ||
|
||
describe('<YearPicker />', () => { | ||
const mount = createMount(); | ||
const render = createPickerRender(); | ||
let classes: Record<string, string>; | ||
|
||
const localizedMount = (node: React.ReactNode) => { | ||
return mount(<LocalizationProvider dateAdapter={AdapterDateFns}>{node}</LocalizationProvider>); | ||
}; | ||
|
||
before(() => { | ||
classes = getClasses( | ||
<YearPicker | ||
minDate={adapterToUse.date('2019-01-01T00:00:00.000')} | ||
maxDate={adapterToUse.date('2029-01-01T00:00:00.000')} | ||
isDateDisabled={() => false} | ||
date={adapterToUse.date()} | ||
onChange={() => {}} | ||
/>, | ||
); | ||
}); | ||
|
||
describeConformance( | ||
describeConformanceV5( | ||
<YearPicker | ||
minDate={adapterToUse.date('2019-01-01T00:00:00.000')} | ||
maxDate={adapterToUse.date('2029-01-01T00:00:00.000')} | ||
|
@@ -40,9 +27,17 @@ describe('<YearPicker />', () => { | |
classes, | ||
inheritComponent: 'div', | ||
mount: localizedMount, | ||
render, | ||
muiName: 'MuiYearPicker', | ||
refInstanceof: window.HTMLDivElement, | ||
// cannot test reactTestRenderer because of required context | ||
skip: ['componentProp', 'propsSpread', 'reactTestRenderer'], | ||
skip: [ | ||
'componentProp', | ||
'componentsProp', | ||
'propsSpread', | ||
'reactTestRenderer', | ||
'themeDefaultProps', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need to skip themeDetaultProps because the current implementation does not receive "other" props. I tried to add "other" props to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like |
||
], | ||
}), | ||
); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { generateUtilityClass, generateUtilityClasses } from '@material-ui/unstyled'; | ||
|
||
export function getYearPickerUtilityClass(slot: string) { | ||
return generateUtilityClass('MuiYearPicker', slot); | ||
} | ||
|
||
const yearPickerClasses = generateUtilityClasses('MuiYearPicker', ['root']); | ||
|
||
export default yearPickerClasses; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to bring the "root" and "name" back 🤔 @oliviertassinari @mnajdova
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed this in 2058f10. @eps1lon is working on reversing the approach in #25754