Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react-grid-material-ui): support indeterminate state for the sele…
…ct all checkbox (#231)
- Loading branch information
Showing
21 changed files
with
475 additions
and
326 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
45 changes: 45 additions & 0 deletions
45
packages/dx-react-grid-bootstrap3/src/templates/table-select-all-cell.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,45 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { setupConsole } from '@devexpress/dx-testing'; | ||
import { TableSelectAllCell } from './table-select-all-cell'; | ||
|
||
describe('TableHeaderCell', () => { | ||
let resetConsole; | ||
beforeAll(() => { | ||
resetConsole = setupConsole({ ignore: ['validateDOMNesting'] }); | ||
}); | ||
afterAll(() => { | ||
resetConsole(); | ||
}); | ||
|
||
it('should render indeterminate state checkbox if the `someSelected` property is true', () => { | ||
const tree = mount( | ||
<TableSelectAllCell | ||
column={{ | ||
name: 'Test', | ||
}} | ||
someSelected | ||
/>, | ||
); | ||
|
||
expect(tree.find('input').getNode().indeterminate) | ||
.toBeTruthy(); | ||
}); | ||
|
||
it('should call the `toggleAll` function on cell click if selection is available', () => { | ||
const toggleAll = jest.fn(); | ||
const tree = mount( | ||
<TableSelectAllCell | ||
column={{ | ||
name: 'Test', | ||
}} | ||
selectionAvailable | ||
toggleAll={toggleAll} | ||
/>, | ||
); | ||
tree.find('input').simulate('change'); | ||
|
||
expect(toggleAll) | ||
.toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
Oops, something went wrong.