GSA / sam-design-system

https://gsa.github.io/sam-design-system/
Other
21 stars 14 forks source link

Horizontal Filter Reset Not Emitting After the First Reset #1495

Open addiedavis opened 1 month ago

addiedavis commented 1 month ago

Components Involved Horizontal Filter

Expected Behavior Every time the reset button is selected on the horizontal filter, the filter emits an empty filter object.

Actual Behavior When a reset of the filter occurs it only emits the empty filter on the first click. Subsequent clicks of the reset button do not emit an empty filter.

Your Environment Angular Version: 17.3.8 @gsa-sam/components: 17.0.5 @gsa-sam/icons: 1.0.0 @gsa-sam/layout: 17.0.1 @gsa-sam/layouts: 17.0.3 @gsa-sam/ngx-uswds: 17.0.1 @gsa-sam/ngx-uswds-icons: 17.0.0 @gsa-sam/sam-formly: 17.0.5 @gsa-sam/sam-material-extensions: 17.0.5 @gsa-sam/sam-styles: 3.0.18 @gsa-sam/shared: 17.0.3

Ticket Number IAEMOD-28579

Additional context Recording of the horizontal filter on 07/26/2024 from https://gsa.github.io/sam-design-system/?path=/story/formly-filter--horizontal

https://drive.google.com/file/d/1HO0K5Mdvx1ObKl9zt5S09Q3e_cZbL8FV/view

addiedavis commented 1 week ago

Update with the new libs: @gsa-sam/components@17.0.8 @gsa-sam/layout@17.0.10 @gsa-sam/layouts@17.0.4 @gsa-sam/ngx-uswds@17.0.1 @gsa-sam/ngx-uswds-icons@17.0.0 @gsa-sam/sam-formly@17.0.8 @gsa-sam/sam-material-extensions@17.0.8 @gsa-sam/sam-styels@3.0.18 @gsa-sam/shared@17.0.10

The reset functionality is broken and selecting the reset does not reset the filter at all. The labels once selected, the green box displaying the selected option, the 'x' in that box no longer un-selects that option

The component also broke our test because the formControl seems disconnected. The test that suddenly started failing is as follows:

it('should clearFilters', () => { component.fileds[0].fieldGroup[0].formControl.setVlue('test'); component.clearFilters(); expect(component.fields[0].fieldGroup[0].formControl.value).toBeUndefined(); });

It failed because 'component.fileds[0].fieldGroup[0].formControl.' is undefined. component.fileds[0].fieldGroup[0] is defined but there is no formControl on it.