-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Timeline] Migrate TimelineContent to emotion (#25781)
- Loading branch information
1 parent
c1ef0ef
commit c9c69b5
Showing
9 changed files
with
131 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 21 additions & 9 deletions
30
packages/material-ui-lab/src/TimelineContent/TimelineContent.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
import * as React from 'react'; | ||
import { getClasses, createMount, describeConformance } from 'test/utils'; | ||
import { expect } from 'chai'; | ||
import { createClientRender, createMount, describeConformanceV5 } from 'test/utils'; | ||
import Typography from '@material-ui/core/Typography'; | ||
import TimelineContent from './TimelineContent'; | ||
import Timeline from '@material-ui/lab/Timeline'; | ||
import TimelineContent, { | ||
timelineContentClasses as classes, | ||
} from '@material-ui/lab/TimelineContent'; | ||
|
||
describe('<TimelineContent />', () => { | ||
const render = createClientRender(); | ||
const mount = createMount(); | ||
let classes; | ||
|
||
before(() => { | ||
classes = getClasses(<TimelineContent />); | ||
}); | ||
|
||
describeConformance(<TimelineContent />, () => ({ | ||
describeConformanceV5(<TimelineContent />, () => ({ | ||
classes, | ||
inheritComponent: Typography, | ||
render, | ||
mount, | ||
muiName: 'MuiTimelineContent', | ||
refInstanceof: window.HTMLDivElement, | ||
skip: ['componentProp'], | ||
skip: ['componentProp', 'componentsProp', 'themeVariants'], | ||
})); | ||
|
||
it('when align right should have alignRight class', () => { | ||
const { getByText } = render( | ||
<Timeline align="right"> | ||
<TimelineContent>content</TimelineContent> | ||
</Timeline>, | ||
); | ||
|
||
expect(getByText('content')).to.have.class(classes.alignRight); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
export { default } from './TimelineContent'; | ||
export * from './TimelineContent'; | ||
|
||
export { default as timelineContentClasses } from './timelineContentClasses'; | ||
export * from './timelineContentClasses'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
export { default } from './TimelineContent'; | ||
|
||
export { default as timelineContentClasses } from './timelineContentClasses'; | ||
export * from './timelineContentClasses'; |
9 changes: 9 additions & 0 deletions
9
packages/material-ui-lab/src/TimelineContent/timelineContentClasses.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { TimelineContentClassKey } from './TimelineContent'; | ||
|
||
export type TimelineContentClasses = Record<TimelineContentClassKey, string>; | ||
|
||
declare const timelineContentClasses: TimelineContentClasses; | ||
|
||
export function getTimelineContentUtilityClass(slot: string): string; | ||
|
||
export default timelineContentClasses; |
14 changes: 14 additions & 0 deletions
14
packages/material-ui-lab/src/TimelineContent/timelineContentClasses.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { generateUtilityClass, generateUtilityClasses } from '@material-ui/unstyled'; | ||
|
||
export function getTimelineContentUtilityClass(slot) { | ||
return generateUtilityClass('MuiTimelineContent', slot); | ||
} | ||
|
||
const timelineContentClasses = generateUtilityClasses('MuiTimelineContent', [ | ||
'root', | ||
'alignLeft', | ||
'alignRight', | ||
'alignAlternate', | ||
]); | ||
|
||
export default timelineContentClasses; |