Skip to content

Commit

Permalink
STSMACOM-880: DateRangeFilter - set the wrongDatesOrder to `false…
Browse files Browse the repository at this point in the history
…` when the field value changes. (#1546)
  • Loading branch information
Dmytro-Melnyshyn authored Dec 3, 2024
1 parent 01c052f commit 93b1068
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Use `<IfAnyPermission>` and `stripes.hasAnyPerm` to check for Notes assign/unassign perm. Fixes STSMACOM-875.
* Fetch updaters in `<ViewMetaData>` on `props.metadata` changes. Fixes STSMACOM-878.
* Use `this.resources` in `StripesConnectedSource` instead of accessing props directly. Fixes STSMACOM-879.
* `DateRangeFilter` - set the `wrongDatesOrder` to `false` when the field value changes. Fixes STSMACOM-880.

## [9.2.0](https://github.com/folio-org/stripes-smart-components/tree/v9.2.0) (2024-10-11)
[Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v9.1.3...v9.2.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const TheComponent = ({
...filterValue,
errors: {
...filterValue.errors,
wrongDatesOrder: false, // dates order is validated only when the "Apply" button is clicked, not when the field value is changed
[errorName]: dateIsInvalid
},
selectedValues: newSelectedValues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ describe('DateRangeFilter', () => {
it('should display corresponding error below the filter', () => ErrorInteractor('Start date is greater than end date').exists());

it('should not apply the filter', () => converge(() => { if (onChangeHandler.called) throw Error('expected onChangeHandler to not be called!'); }));

describe('and then both dates were cleared', () => {
beforeEach(async () => {
await startPicker.fillIn('');
await endPicker.fillIn('');
});

it('should not display an error below the filter', () => ErrorInteractor('Start date is greater than end date').absent());
});
});

describe('when date range is correct and "Apply" button was clicked', () => {
Expand Down

0 comments on commit 93b1068

Please sign in to comment.