mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
fix closing search bar has not to trigger search (#2415)
This commit is contained in:
parent
be19fe93d0
commit
ba908e5f0e
@ -1,13 +1,13 @@
|
||||
<form #f="ngForm" (ngSubmit)="onSearch(f.value)" class="adf-search-form">
|
||||
<div class="adf-search-container"
|
||||
[@transitionMessages]="subscriptAnimationState">
|
||||
<button md-button
|
||||
<a md-button
|
||||
*ngIf="expandable"
|
||||
id="adf-search-button"
|
||||
(click)="toggleSearchBar()"
|
||||
class="adf-search-button">
|
||||
<md-icon aria-label="search button">search</md-icon>
|
||||
</button>
|
||||
</a>
|
||||
<div class="adf-search-field">
|
||||
<md-input-container>
|
||||
<input
|
||||
|
@ -340,6 +340,28 @@ describe('SearchControlComponent', () => {
|
||||
}, 500);
|
||||
});
|
||||
|
||||
it('click on the search button should not trigger the search when you click on it to close the search bar', (done) => {
|
||||
spyOn(searchService, 'getQueryNodesPromise')
|
||||
.and.returnValue(Promise.resolve(results));
|
||||
|
||||
component.liveSearchTerm = 'test';
|
||||
|
||||
fixture.detectChanges();
|
||||
component.subscriptAnimationState = 'active';
|
||||
|
||||
let searchButton: any = element.querySelector('#adf-search-button');
|
||||
searchButton.click();
|
||||
|
||||
setTimeout(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.liveSearchComponent.panelAnimationState).not.toBe('void');
|
||||
let resultElement: Element = element.querySelector('#adf-search-results');
|
||||
expect(resultElement).toBe(null);
|
||||
done();
|
||||
done();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
it('click on the search button should open the input box when is close', (done) => {
|
||||
fixture.detectChanges();
|
||||
component.subscriptAnimationState = 'inactive';
|
||||
|
Loading…
x
Reference in New Issue
Block a user