Skip to content

Commit

Permalink
feat(stark-ui): route-search - add support for partial matching
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #1335
  • Loading branch information
SuperITMan committed Jan 19, 2020
1 parent 56b84f8 commit c9802d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ describe("RouteSearchComponent", () => {
expect(result.length).toBe(2);
expect(result[0]).toEqual({ label: "Test 1", targetState: "test1", targetStateParams: undefined });
expect(result[1]).toEqual({ label: "Test 2", targetState: "test2", targetStateParams: undefined });

result = component.filterRouteEntries("st");
expect(result.length).toBe(2);
expect(result[0]).toEqual({ label: "Test 1", targetState: "test1", targetStateParams: undefined });
expect(result[1]).toEqual({ label: "Test 2", targetState: "test2", targetStateParams: undefined });
});

it("should return an empty array if the input is not in the list", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class StarkRouteSearchComponent extends AbstractStarkUiComponent implemen
routeEntry.label
.toString()
.toLowerCase()
.indexOf(filterValue) === 0
.includes(filterValue)
);
}

Expand Down

0 comments on commit c9802d7

Please sign in to comment.