-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
86 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
55 changes: 55 additions & 0 deletions
55
packages/grid/data-grid/src/tests/components.DataGrid.test.tsx
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,55 @@ | ||
import * as React from 'react'; | ||
import { createClientRenderStrictMode } from 'test/utils'; | ||
import { expect } from 'chai'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
|
||
describe('<DataGrid /> - Components', () => { | ||
// TODO v5: replace with createClientRender | ||
const render = createClientRenderStrictMode(); | ||
|
||
const baselineProps = { | ||
rows: [ | ||
{ | ||
id: 0, | ||
brand: 'Nike', | ||
}, | ||
{ | ||
id: 1, | ||
brand: 'Adidas', | ||
}, | ||
{ | ||
id: 2, | ||
brand: 'Puma', | ||
}, | ||
], | ||
columns: [{ field: 'brand' }], | ||
}; | ||
|
||
describe('footer', () => { | ||
before(function beforeHook() { | ||
if (/jsdom/.test(window.navigator.userAgent)) { | ||
// Need layouting | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('should hide footer if prop hideFooter is set', () => { | ||
render( | ||
<div style={{ width: 300, height: 500 }}> | ||
<DataGrid {...baselineProps} hideFooter /> | ||
</div>, | ||
); | ||
expect(document.querySelectorAll('.MuiDataGrid-footer').length).to.equal(0); | ||
}); | ||
|
||
it('should hide custom footer if prop hideFooter is set', () => { | ||
const CustomFooter = () => <div className="customFooter">Custom Footer</div>; | ||
render( | ||
<div style={{ width: 300, height: 500 }}> | ||
<DataGrid {...baselineProps} hideFooter components={{ footer: CustomFooter }} /> | ||
</div>, | ||
); | ||
expect(document.querySelectorAll('.customFooter').length).to.equal(0); | ||
}); | ||
}); | ||
}); |
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,5 +1,9 @@ | ||
# Datagrid & X-Grid Storybook | ||
|
||
## Start the storybook | ||
|
||
yarn start | ||
|
||
## Run the integration test on stories | ||
|
||
yarn test |
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