Skip to content

Commit

Permalink
UIMARCAUTH-14 Display a Date Created filter (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariiaschv authored Dec 14, 2021
1 parent ee4238d commit e0412e3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
* [UIMARCAUTH-16](https://issues.folio.org/browse/UIMARCAUTH-16) Implement MARC Authorities Search Box.
* [UIMARCAUTH-20](https://issues.folio.org/browse/UIMARCAUTH-20) Implement Results List Column Chooser.
* [UIMARCAUTH-15](https://issues.folio.org/browse/UIMARCAUTH-15) Display a Date Updated filter.
* [UIMARCAUTH-14](https://issues.folio.org/browse/UIMARCAUTH-14) Display a Date Created filter.
4 changes: 4 additions & 0 deletions src/constants/filterConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { buildDateRangeQuery } from '../utils';

export const filterConfig = [
{
name: 'createdDate',
parse: buildDateRangeQuery('createdDate'),
},
{
name: 'updatedDate',
parse: buildDateRangeQuery('updatedDate'),
Expand Down
11 changes: 11 additions & 0 deletions src/views/AuthoritiesSearch/AuthoritiesSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,17 @@ const AuthoritiesSearch = ({ children }) => {
</Button>
</form>

<AcqDateRangeFilter
activeFilters={activeFilters?.createdDate || []}
labelId="ui-marc-authorities.createdDate"
id="createdDate"
name="createdDate"
onChange={applyFilters}
disabled={isLoading}
closedByDefault
dateFormat={DATE_FORMAT}
/>

<AcqDateRangeFilter
activeFilters={activeFilters?.updatedDate || []}
labelId="ui-marc-authorities.updatedDate"
Expand Down
8 changes: 4 additions & 4 deletions src/views/AuthoritiesSearch/AuthoritiesSearch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ describe('Given AuthoritiesSearch', () => {
expect(getByTestId('search-textarea')).toBeDefined();
});

it('should display Search button', () => {
it('should display "Search" button', () => {
const { getByRole } = renderAuthoritiesSearch();

expect(getByRole('button', { name: 'ui-marc-authorities.label.search' })).toBeDefined();
});

it('should display Reset all button', () => {
it('should display "Reset all" button', () => {
const { getByRole } = renderAuthoritiesSearch();

expect(getByRole('button', { name: 'stripes-smart-components.resetAll' })).toBeDefined();
});

it('display "Action" button', () => {
it('should display "Actions" button', () => {
const { getByRole } = renderAuthoritiesSearch();

expect(getByRole('button', { name: 'stripes-components.paneMenuActionsToggleLabel' })).toBeDefined();
Expand Down Expand Up @@ -196,7 +196,7 @@ describe('Given AuthoritiesSearch', () => {
});
});

describe('when click on "Action" button', () => {
describe('when click on "Actions" button', () => {
it('should display "Show columns" section', () => {
const {
getByRole,
Expand Down
1 change: 1 addition & 0 deletions translations/ui-marc-authorities/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"authorityUUID": "Authority UUID",
"marcHeading": "MARC authority record",
"authorityRecordSubtitle": "{heading} • Last updated: {lastUpdatedDate}",
"createdDate": "Date created",
"updatedDate": "Date updated"
}

0 comments on commit e0412e3

Please sign in to comment.