-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AAE-19610] Submit query on change event for search date range tabbed…
… widget (#9256) * [AAE-19610] Add default actions to search date range tabbed widget * [AAE-19610] Update filter on change * [AAE-19610] Add tests * [AAE-19610] Fix lint issue * [AAE-19610] Add debounceTime * [AAE-19610] Add wrapper to search-filter * [AAE-19610] Fix lint * [AAE-19610] Remove leftover changes
- Loading branch information
1 parent
720fbb9
commit fdab441
Showing
6 changed files
with
151 additions
and
5 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
.../lib/search/components/search-filter/search-filter-card/search-filter-card.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="adf-search-filter-card"> | ||
<adf-search-widget-container | ||
[id]="category.id" | ||
[selector]="category.component.selector" | ||
[settings]="category.component.settings"> | ||
</adf-search-widget-container> | ||
<div class="adf-search-filter-card-actions"> | ||
<button mat-button class="adf-search-action-button" (click)="clear()" id="clear-filter-button"> | ||
{{ 'SEARCH.FILTER.BUTTONS.CLEAR' | translate }} | ||
</button> | ||
<button mat-flat-button class="adf-search-action-button" color="primary" (click)="apply()" id="apply-filter-button"> | ||
{{ 'SEARCH.FILTER.BUTTONS.APPLY' | translate }} | ||
</button> | ||
</div> | ||
</div> |
88 changes: 88 additions & 0 deletions
88
...b/search/components/search-filter/search-filter-card/search-filter-card.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/*! | ||
* @license | ||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { ContentTestingModule } from '../../../../testing/content.testing.module'; | ||
import { SearchFilterCardComponent } from './search-filter-card.component'; | ||
|
||
describe('SearchFilterCardComponent', () => { | ||
let component: SearchFilterCardComponent; | ||
let fixture: ComponentFixture<SearchFilterCardComponent>; | ||
|
||
const mockCategory = { | ||
id: 'test-id', | ||
name: 'test-name', | ||
enabled: true, | ||
expanded: false, | ||
component: { | ||
selector: 'date-range', | ||
settings: { | ||
pattern: 'test-pattern', | ||
field: 'test-field', | ||
placeholder: 'test-placeholder' | ||
} | ||
} | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
TranslateModule.forRoot(), | ||
ContentTestingModule | ||
] | ||
}); | ||
fixture = TestBed.createComponent(SearchFilterCardComponent); | ||
component = fixture.componentInstance; | ||
component.category = mockCategory; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should call clear method on clear button click', () => { | ||
spyOn(component, 'clear'); | ||
|
||
const clearButton = fixture.debugElement.nativeElement.querySelector('#clear-filter-button'); | ||
clearButton.click(); | ||
|
||
expect(component.clear).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should call apply method on apply button click', () => { | ||
spyOn(component, 'apply'); | ||
|
||
const applyButton = fixture.debugElement.nativeElement.querySelector('#apply-filter-button'); | ||
applyButton.click(); | ||
|
||
expect(component.apply).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should call resetInnerWidget method on clear', () => { | ||
spyOn(component.widgetContainerComponent, 'resetInnerWidget'); | ||
|
||
component.clear(); | ||
|
||
expect(component.widgetContainerComponent.resetInnerWidget).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should call applyInnerWidget method on apply', () => { | ||
spyOn(component.widgetContainerComponent, 'applyInnerWidget'); | ||
|
||
component.apply(); | ||
|
||
expect(component.widgetContainerComponent.applyInnerWidget).toHaveBeenCalled(); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
...rc/lib/search/components/search-filter/search-filter-card/search-filter-card.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/*! | ||
* @license | ||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Component, Input, ViewChild, ViewEncapsulation } from '@angular/core'; | ||
import { SearchWidgetContainerComponent } from '../../search-widget-container/search-widget-container.component'; | ||
import { SearchCategory } from '../../../models/search-category.interface'; | ||
|
||
@Component({ | ||
selector: 'adf-search-filter-card', | ||
templateUrl: './search-filter-card.component.html', | ||
encapsulation: ViewEncapsulation.None | ||
}) | ||
export class SearchFilterCardComponent { | ||
@Input() | ||
category: SearchCategory; | ||
|
||
@ViewChild(SearchWidgetContainerComponent, { static: false }) | ||
widgetContainerComponent: SearchWidgetContainerComponent; | ||
|
||
clear() { | ||
this.widgetContainerComponent.resetInnerWidget(); | ||
} | ||
|
||
apply() { | ||
this.widgetContainerComponent.applyInnerWidget(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters