diff --git a/starsky/starsky/clientapp/src/components/atoms/current-location-button/current-location-button.tsx b/starsky/starsky/clientapp/src/components/atoms/current-location-button/current-location-button.tsx index c8426c4cf4..6e99f4620f 100644 --- a/starsky/starsky/clientapp/src/components/atoms/current-location-button/current-location-button.tsx +++ b/starsky/starsky/clientapp/src/components/atoms/current-location-button/current-location-button.tsx @@ -25,6 +25,7 @@ const CurrentLocationButton: React.FunctionComponent { + it("get colorClass back", () => { + // Mock necessary dependencies + const historyLocationSearch = "your-history-location-search"; + const state = { + fileIndexItems: {} + } as IArchiveProps; + + // Call the function + const result = GetFilterUrlColorClass(1, historyLocationSearch, state); + + // Assertions + expect(result).toBe("?colorClass=1"); + }); + + it("get select back", () => { + // Mock necessary dependencies + const historyLocationSearch = "?select=test.jpg"; + const state = { + fileIndexItems: [ + { + ...newIFileIndexItem(), + fileName: "test.jpg", + colorClass: 1 + } as IFileIndexItem + ] + } as IArchiveProps; + + // Call the function + const result = GetFilterUrlColorClass(1, historyLocationSearch, state); + + // Assertions + expect(result).toBe("?select=test.jpg&colorClass=1"); + }); +}); diff --git a/starsky/starsky/clientapp/src/shared/select-check-if-active.ts b/starsky/starsky/clientapp/src/shared/select-check-if-active.ts index bf4415125e..34d3e75daf 100644 --- a/starsky/starsky/clientapp/src/shared/select-check-if-active.ts +++ b/starsky/starsky/clientapp/src/shared/select-check-if-active.ts @@ -1,19 +1,19 @@ -import { IFileIndexItem } from "../interfaces/IFileIndexItem"; +import {IFileIndexItem} from "../interfaces/IFileIndexItem"; export class SelectCheckIfActive { public IsActive( select: string[] | undefined, - colorclasses: number[], + colorClasses: number[], fileIndexItems: IFileIndexItem[] ) { if (!select) return []; - // it should contain on the colorclasses + // it should contain on the colorClasses const fileNameList = fileIndexItems - .filter((el) => el.colorClass !== undefined && colorclasses.indexOf(el.colorClass) !== -1) + .filter((el) => el.colorClass !== undefined && colorClasses.indexOf(el.colorClass) !== -1) .map((ele) => ele.fileName); - // you can't select an item thats not shown + // you can't select an item that's not shown select.forEach((selectedPath) => { if (fileNameList.indexOf(selectedPath) === -1) { const selectIndex = select.indexOf(selectedPath);