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)

(cherry picked from commit 93b1068)
  • Loading branch information
Dmytro-Melnyshyn authored and zburke committed Dec 10, 2024
1 parent b4a3849 commit 328fccb
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 @@ -3,6 +3,7 @@
## 9.2.6

* Use `<IfAnyPermission>` and `stripes.hasAnyPerm` to check for Notes assign/unassign perm. Fixes STSMACOM-875.
* `DateRangeFilter` - set the `wrongDatesOrder` to `false` when the field value changes. Fixes STSMACOM-880.

## [9.2.5](https://github.com/folio-org/stripes-smart-components/tree/v9.2.5) (2024-12-05)
[Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v9.2.4...v9.2.5)
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 328fccb

Please sign in to comment.