-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: the display only filter doesn't render a search box
- Loading branch information
Showing
4 changed files
with
24 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import React from 'react'; | ||
import TableFilter from './TableFilter'; | ||
|
||
export default class DisplayOnlyFilter extends TableFilter { | ||
constructor(title) { | ||
super(title, undefined, {sortable: false, filterable: false}); | ||
} | ||
|
||
Component = () => <td />; | ||
} |
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
17 changes: 17 additions & 0 deletions
17
app/tests/unit/components/FilterableTable/Filters/DisplayOnlyFilter.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,17 @@ | ||
import React from 'react'; | ||
import {DisplayOnlyFilter} from 'components/FilterableTable/Filters'; | ||
import {mount} from 'enzyme'; | ||
|
||
describe('the display only filter option', () => { | ||
const filterUnderTest = new DisplayOnlyFilter('display header'); | ||
|
||
it('renders an empty td component', () => { | ||
const rendered = mount(<filterUnderTest.Component />); | ||
expect(rendered).toMatchSnapshot(); | ||
}); | ||
|
||
it('should not be sortable or searchable', () => { | ||
expect(filterUnderTest.isSearchEnabled).toBeFalse(); | ||
expect(filterUnderTest.isSortEnabled).toBeFalse(); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...sts/unit/components/FilterableTable/Filters/__snapshots__/DisplayOnlyFilter.test.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,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`the display only filter option renders an empty td component 1`] = `<td />`; |