Update search component to work with 0.4.0 JS API

- Use new search (query) methods
- Allow search parameters to be overridden by component
- Fix up tests

Refs #555
This commit is contained in:
Will Abson
2016-11-04 14:21:19 +00:00
parent 903c313615
commit 0e127c26af
13 changed files with 172 additions and 65 deletions

View File

@@ -176,7 +176,7 @@ describe('AlfrescoSearchControlComponent', () => {
it('should keep find-as-you-type control visible when user tabs into results', (done) => {
let searchService = fixture.debugElement.injector.get(AlfrescoSearchService);
spyOn(searchService, 'getSearchNodesPromise')
spyOn(searchService, 'getQueryNodesPromise')
.and.returnValue(Promise.resolve(result));
fixture.detectChanges();
@@ -219,7 +219,7 @@ describe('AlfrescoSearchControlComponent', () => {
it('should select the first result in find-as-you-type when down arrow is pressed and FAYT is visible', (done) => {
fixture.detectChanges();
spyOn(component.autocompleteComponent, 'focusResult');
spyOn(component.liveSearchComponent, 'focusResult');
fixture.detectChanges();
inputEl.dispatchEvent(new Event('focus'));
window.setTimeout(() => { // wait for debounce() to complete
@@ -228,7 +228,7 @@ describe('AlfrescoSearchControlComponent', () => {
key: 'ArrowDown'
}));
fixture.detectChanges();
expect(component.autocompleteComponent.focusResult).toHaveBeenCalled();
expect(component.liveSearchComponent.focusResult).toHaveBeenCalled();
done();
}, 100);
});
@@ -254,7 +254,7 @@ describe('AlfrescoSearchControlComponent', () => {
});
it('should NOT display a find-as-you-type control when configured not to', () => {
fixture.componentInstance.autocompleteEnabled = false;
fixture.componentInstance.liveSearchEnabled = false;
fixture.detectChanges();
let autocomplete: Element = element.querySelector('alfresco-search-autocomplete');
expect(autocomplete).toBeNull();