-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge with master and resolve conflicts
- Loading branch information
Showing
21 changed files
with
337 additions
and
85 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// TODO: test matching media queries | ||
// import mediaQuery from 'css-mediaquery' | ||
import * as React from 'react' | ||
import renderer from 'react-test-renderer' | ||
|
||
import * as Buttons from './' | ||
|
||
describe('components/Buttons/Iconized', () => { | ||
it('render icon and label', () => { | ||
const tree = renderer.create(<Buttons.Iconized icon="ac_unit" label="A" />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
it('render rotated', () => { | ||
const tree = renderer | ||
.create(<Buttons.Iconized icon="ac_unit" label="A" rotate />) | ||
.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
it('render contained', () => { | ||
const tree = renderer | ||
.create(<Buttons.Iconized icon="ac_unit" label="A" variant="contained" />) | ||
.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react' | ||
import renderer from 'react-test-renderer' | ||
|
||
import * as Buttons from './' | ||
|
||
describe('components/Buttons/Skeleton', () => { | ||
it('render medium by default', () => { | ||
const tree = renderer.create(<Buttons.Skeleton />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
it('render small', () => { | ||
const tree = renderer.create(<Buttons.Skeleton size="small" />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
it('render large', () => { | ||
const tree = renderer.create(<Buttons.Skeleton size="large" />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
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,37 @@ | ||
import cx from 'classnames' | ||
import * as React from 'react' | ||
import * as M from '@material-ui/core' | ||
|
||
import Skeleton from 'components/Skeleton' | ||
|
||
const useStyles = M.makeStyles((t) => ({ | ||
root: { | ||
borderRadius: '4px', | ||
boxShadow: t.shadows[4], | ||
display: 'inline-flex', | ||
verticalAlign: 'middle', | ||
width: t.spacing(15), | ||
}, | ||
small: { | ||
height: t.spacing(3.75), | ||
}, | ||
medium: { | ||
height: t.spacing(4.5), | ||
}, | ||
large: { | ||
height: t.spacing(5), | ||
}, | ||
})) | ||
|
||
interface ButtonSkeletonProps { | ||
className?: string | ||
size?: 'small' | 'medium' | 'large' | ||
} | ||
|
||
export default function ButtonSkeleton({ | ||
className, | ||
size = 'medium', | ||
}: ButtonSkeletonProps) { | ||
const classes = useStyles() | ||
return <Skeleton className={cx(classes.root, classes[size], className)} /> | ||
} |
112 changes: 112 additions & 0 deletions
112
catalog/app/components/Buttons/__snapshots__/Iconized.spec.tsx.snap
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,112 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`components/Buttons/Iconized render contained 1`] = ` | ||
<button | ||
className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedSizeSmall MuiButton-sizeSmall" | ||
disabled={false} | ||
onBlur={[Function]} | ||
onDragLeave={[Function]} | ||
onFocus={[Function]} | ||
onKeyDown={[Function]} | ||
onKeyUp={[Function]} | ||
onMouseDown={[Function]} | ||
onMouseLeave={[Function]} | ||
onMouseUp={[Function]} | ||
onTouchEnd={[Function]} | ||
onTouchMove={[Function]} | ||
onTouchStart={[Function]} | ||
tabIndex={0} | ||
type="button" | ||
> | ||
<span | ||
className="MuiButton-label" | ||
> | ||
<span | ||
className="MuiButton-startIcon MuiButton-iconSizeSmall" | ||
> | ||
<span | ||
aria-hidden={true} | ||
className="material-icons MuiIcon-root makeStyles-icon-1" | ||
> | ||
ac_unit | ||
</span> | ||
</span> | ||
A | ||
</span> | ||
</button> | ||
`; | ||
|
||
exports[`components/Buttons/Iconized render icon and label 1`] = ` | ||
<button | ||
className="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedSizeSmall MuiButton-sizeSmall" | ||
disabled={false} | ||
onBlur={[Function]} | ||
onDragLeave={[Function]} | ||
onFocus={[Function]} | ||
onKeyDown={[Function]} | ||
onKeyUp={[Function]} | ||
onMouseDown={[Function]} | ||
onMouseLeave={[Function]} | ||
onMouseUp={[Function]} | ||
onTouchEnd={[Function]} | ||
onTouchMove={[Function]} | ||
onTouchStart={[Function]} | ||
tabIndex={0} | ||
type="button" | ||
> | ||
<span | ||
className="MuiButton-label" | ||
> | ||
<span | ||
className="MuiButton-startIcon MuiButton-iconSizeSmall" | ||
> | ||
<span | ||
aria-hidden={true} | ||
className="material-icons MuiIcon-root makeStyles-icon-1" | ||
> | ||
ac_unit | ||
</span> | ||
</span> | ||
A | ||
</span> | ||
</button> | ||
`; | ||
|
||
exports[`components/Buttons/Iconized render rotated 1`] = ` | ||
<button | ||
className="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedSizeSmall MuiButton-sizeSmall" | ||
disabled={false} | ||
onBlur={[Function]} | ||
onDragLeave={[Function]} | ||
onFocus={[Function]} | ||
onKeyDown={[Function]} | ||
onKeyUp={[Function]} | ||
onMouseDown={[Function]} | ||
onMouseLeave={[Function]} | ||
onMouseUp={[Function]} | ||
onTouchEnd={[Function]} | ||
onTouchMove={[Function]} | ||
onTouchStart={[Function]} | ||
tabIndex={0} | ||
type="button" | ||
> | ||
<span | ||
className="MuiButton-label" | ||
> | ||
<span | ||
className="MuiButton-startIcon MuiButton-iconSizeSmall" | ||
> | ||
<span | ||
aria-hidden={true} | ||
className="material-icons MuiIcon-root makeStyles-icon-1 makeStyles-iconRotated-2" | ||
> | ||
ac_unit | ||
</span> | ||
</span> | ||
A | ||
</span> | ||
<span | ||
className="MuiTouchRipple-root" | ||
/> | ||
</button> | ||
`; |
19 changes: 19 additions & 0 deletions
19
catalog/app/components/Buttons/__snapshots__/Skeleton.spec.tsx.snap
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,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`components/Buttons/Skeleton render large 1`] = ` | ||
<div | ||
className="MuiBox-root MuiBox-root-10 makeStyles-root-1 makeStyles-large-4 makeStyles-root-5 makeStyles-animate-7" | ||
/> | ||
`; | ||
|
||
exports[`components/Buttons/Skeleton render medium by default 1`] = ` | ||
<div | ||
className="MuiBox-root MuiBox-root-8 makeStyles-root-1 makeStyles-medium-3 makeStyles-root-5 makeStyles-animate-7" | ||
/> | ||
`; | ||
|
||
exports[`components/Buttons/Skeleton render small 1`] = ` | ||
<div | ||
className="MuiBox-root MuiBox-root-9 makeStyles-root-1 makeStyles-small-2 makeStyles-root-5 makeStyles-animate-7" | ||
/> | ||
`; |
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,2 @@ | ||
export { default as Iconized } from './Iconized' | ||
export { default as Skeleton } from './Skeleton' |
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
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
Oops, something went wrong.