-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6031975
commit 7d02f97
Showing
3 changed files
with
97 additions
and
0 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,40 @@ | ||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import Cell from './cell'; | ||
|
||
test('Cell > Adds default classNames', () => { | ||
const wrapper = shallow(<Cell />, { disableLifecycleMethods: true }); | ||
const expected = 'mdc-layout-grid__cell'; | ||
|
||
const actual = wrapper.props().className; | ||
|
||
expect(actual).toBe(expected); | ||
}); | ||
|
||
test('Cell > Adds all classNames based on props', () => { | ||
const ALIGN = 'bottom'; | ||
const CLASS_NAME = 'CLASS_NAME'; | ||
const COLUMNS = 12; | ||
const DESKTOP = 12; | ||
const PHONE = 4; | ||
const TABLET = 8; | ||
const wrapper = shallow( | ||
<Cell | ||
align={ALIGN} | ||
className={CLASS_NAME} | ||
columns={COLUMNS} | ||
desktop={DESKTOP} | ||
phone={PHONE} | ||
tablet={TABLET} | ||
/>, | ||
{ disableLifecycleMethods: true }, | ||
); | ||
const expected = `mdc-layout-grid__cell ${CLASS_NAME} mdc-layout-grid__cell--align-${ALIGN} ` + | ||
`mdc-layout-grid__cell--span-${COLUMNS} mdc-layout-grid__cell--span-${DESKTOP}-desktop ` + | ||
`mdc-layout-grid__cell--span-${PHONE}-phone mdc-layout-grid__cell--span-${TABLET}-tablet`; | ||
|
||
const actual = wrapper.props().className; | ||
|
||
expect(actual).toBe(expected); | ||
}); |
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,29 @@ | ||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import Grid from './grid'; | ||
|
||
const CHILDREN = <p>CHILDREN</p>; | ||
|
||
test('Grid > Adds the default classNames', () => { | ||
const wrapper = shallow(<Grid>{CHILDREN}</Grid>, { disableLifecycleMethods: true }); | ||
const expected = 'mdc-layout-grid'; | ||
|
||
const actual = wrapper.props().className; | ||
|
||
expect(actual).toBe(expected); | ||
}); | ||
|
||
test('Grid > Adds all classNames based on props', () => { | ||
const ALIGN = 'left'; | ||
const CLASS_NAME = 'CLASS_NAME'; | ||
const wrapper = shallow( | ||
<Grid align={ALIGN} className={CLASS_NAME}>{CHILDREN}</Grid>, | ||
{ disableLifecycleMethods: true }, | ||
); | ||
const expected = `mdc-layout-grid mdc-layout-grid--align-${ALIGN} ${CLASS_NAME}`; | ||
|
||
const actual = wrapper.props().className; | ||
|
||
expect(actual).toBe(expected); | ||
}); |
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,28 @@ | ||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import Row from './row'; | ||
|
||
const CHILDREN = <p>CHILDREN</p>; | ||
|
||
test('Row > Adds the default classNames', () => { | ||
const wrapper = shallow(<Row>{CHILDREN}</Row>, { disableLifecycleMethods: true }); | ||
const expected = 'mdc-layout-grid__inner'; | ||
|
||
const actual = wrapper.props().className; | ||
|
||
expect(actual).toBe(expected); | ||
}); | ||
|
||
test('Row > Adds all classNames based on props', () => { | ||
const CLASS_NAME = 'CLASS_NAME'; | ||
const wrapper = shallow( | ||
<Row className={CLASS_NAME}>{CHILDREN}</Row>, | ||
{ disableLifecycleMethods: true }, | ||
); | ||
const expected = `mdc-layout-grid__inner ${CLASS_NAME}`; | ||
|
||
const actual = wrapper.props().className; | ||
|
||
expect(actual).toBe(expected); | ||
}); |