Skip to content

Commit

Permalink
Delegate search composition to be
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic committed Mar 7, 2024
1 parent ae2ff04 commit 48e7a25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,19 @@ describe('SearchWindowComponent', () => {
expect(prepareConfigSpy).toHaveBeenCalledTimes(1);
}));

it('should _parseSearchString', () => {
component.searchString = 'someSearch';
expect(component['_parseSearchString']()).toEqual(
{
location: ['id'],
tags: [],
ownerGroup: "",
createdBy: "",
startDate: "",
endDate: "",
}
);
expect(component.searchString).toEqual('someSearch');
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,11 @@ export class SearchWindowComponent implements OnInit {
startDate: "",
endDate: "",
}
let searchValue = "";
let searchParts = this.searchString.split(" ");
searchParts.forEach(searchPart => {
console.log(searchPart);
if (searchPart.length > 0) {
if (searchPart.startsWith("@")) {
searchResult.ownerGroup = searchPart.slice(1);
} else if (searchPart.startsWith("#")) {
console.log(searchPart)
searchResult.tags.push(searchPart.slice(1));
} else {
searchValue += " " + searchPart;
}
}
})
console.log("local search")
searchResult.location.push(this.logbookInfo.logbookInfo.id);
console.log("Search value: ", searchValue);
console.log("Search value: ", this.searchString);
console.log("Search config: ", searchResult)
this.searchDataservice.searchString = searchValue;
this.searchDataservice.searchString = this.searchString;
return searchResult;
}

Expand Down

0 comments on commit 48e7a25

Please sign in to comment.