-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-grid): add components for the Grid plugin (#553)
- Loading branch information
1 parent
6788ba6
commit 314f0d8
Showing
7 changed files
with
76 additions
and
64 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
27 changes: 27 additions & 0 deletions
27
packages/dx-react-grid-bootstrap3/src/templates/layout.test.jsx
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,27 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { Root } from './layout'; | ||
|
||
describe('Layout', () => { | ||
describe('Root', () => { | ||
it('should pass className to the root element', () => { | ||
const tree = shallow(( | ||
<Root className="custom-class" /> | ||
)); | ||
|
||
expect(tree.is('.custom-class')) | ||
.toBeTruthy(); | ||
expect(tree.is('.panel-default')) | ||
.toBeTruthy(); | ||
}); | ||
|
||
it('should pass rest props to the root element', () => { | ||
const tree = shallow(( | ||
<Root data={{ a: 1 }} /> | ||
)); | ||
|
||
expect(tree.props().data) | ||
.toMatchObject({ a: 1 }); | ||
}); | ||
}); | ||
}); |
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
68 changes: 13 additions & 55 deletions
68
packages/dx-react-grid-material-ui/src/templates/layout.test.jsx
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,66 +1,24 @@ | ||
import React from 'react'; | ||
import { createMount, getClasses } from 'material-ui/test-utils'; | ||
import { setupConsole } from '@devexpress/dx-testing'; | ||
import { Header, Footer } from './layout'; | ||
import { shallow } from 'enzyme'; | ||
import { Root } from './layout'; | ||
|
||
describe('Layout', () => { | ||
let resetConsole; | ||
beforeAll(() => { | ||
resetConsole = setupConsole({ ignore: ['SheetsRegistry'] }); | ||
}); | ||
afterAll(() => { | ||
resetConsole(); | ||
}); | ||
|
||
describe('Header', () => { | ||
let mount; | ||
let classes; | ||
beforeAll(() => { | ||
classes = getClasses(( | ||
<Header> | ||
<div /> | ||
</Header> | ||
)); | ||
mount = createMount(); | ||
}); | ||
afterAll(() => { | ||
mount.cleanUp(); | ||
}); | ||
|
||
it('should have a correct css class', () => { | ||
const tree = mount(( | ||
<Header> | ||
<div /> | ||
</Header> | ||
describe('Root', () => { | ||
it('should pass className to the root element', () => { | ||
const tree = shallow(( | ||
<Root className="custom-class" /> | ||
)); | ||
|
||
expect(tree.find(`.${classes.headingPanel}`).exists()).toBeTruthy(); | ||
expect(tree.is('.custom-class')) | ||
.toBeTruthy(); | ||
}); | ||
}); | ||
|
||
describe('Footer', () => { | ||
let mount; | ||
let classes; | ||
beforeAll(() => { | ||
classes = getClasses(( | ||
<Footer> | ||
<div /> | ||
</Footer> | ||
)); | ||
mount = createMount(); | ||
}); | ||
afterAll(() => { | ||
mount.cleanUp(); | ||
}); | ||
|
||
it('should have a correct css class', () => { | ||
const tree = mount(( | ||
<Footer> | ||
<div /> | ||
</Footer> | ||
it('should pass rest props to the root element', () => { | ||
const tree = shallow(( | ||
<Root data={{ a: 1 }} /> | ||
)); | ||
|
||
expect(tree.find(`.${classes.footerPanel}`).exists()).toBeTruthy(); | ||
expect(tree.props().data) | ||
.toMatchObject({ a: 1 }); | ||
}); | ||
}); | ||
}); |
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