Skip to content

Commit

Permalink
UISACQCOMP-227 added tests for AcqDateRangeFilter reset
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanDenis committed Nov 6, 2024
1 parent f231c8c commit a2d5227
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/AcqDateRangeFilter/AcqDateRangeFilter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import AcqDateRangeFilter from './AcqDateRangeFilter';
const FILTER_LABEL = 'some date filter';
const FILTER_NAME = 'some-date-filter';

const mockSubscribeOnReset = jest.fn();

const renderFilter = (closedByDefault, onChange = noop, dateFormat) => (render(
<AcqDateRangeFilter
id="some-date-filter"
Expand All @@ -15,6 +17,7 @@ const renderFilter = (closedByDefault, onChange = noop, dateFormat) => (render(
closedByDefault={closedByDefault}
onChange={onChange}
dateFormat={dateFormat}
subscribeOnReset={mockSubscribeOnReset}
/>,
));

Expand All @@ -32,6 +35,12 @@ describe('AcqDateRangeFilter component', () => {
expect(button.getAttribute('aria-expanded') || 'false').toBe('false');
});

it('should subscribe to reset events', () => {
renderFilter();

expect(mockSubscribeOnReset).toHaveBeenCalled();
});

it('should be opened by default when closedByDefault=false prop is passed', () => {
const { container } = renderFilter(false);
const button = container.querySelector('[id="accordion-toggle-button-some-date-filter"]');
Expand Down

0 comments on commit a2d5227

Please sign in to comment.