-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
13 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...lientapp/src/components/molecules/item-text-list-view/internal/get-box-class-name.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { IFileIndexItem } from "../../../../interfaces/IFileIndexItem"; | ||
import { IExifStatus } from "../../../../interfaces/IExifStatus"; | ||
import { GetBoxClassName } from "./get-box-class-name"; | ||
|
||
describe("GetBoxClassName function", () => { | ||
it("should return correct class name for directory items", () => { | ||
const item: IFileIndexItem = { isDirectory: true, status: null } as unknown as IFileIndexItem; | ||
expect(GetBoxClassName(item)).toBe("box isDirectory-true"); | ||
}); | ||
|
||
it("should return correct class name for items with OK status", () => { | ||
const item: IFileIndexItem = { | ||
isDirectory: false, | ||
status: IExifStatus.Ok | ||
} as unknown as IFileIndexItem; | ||
expect(GetBoxClassName(item)).toBe("box isDirectory-false"); | ||
}); | ||
|
||
it("should return correct class name for items with Default status", () => { | ||
const item: IFileIndexItem = { | ||
isDirectory: false, | ||
status: IExifStatus.Default | ||
} as unknown as IFileIndexItem; | ||
expect(GetBoxClassName(item)).toBe("box isDirectory-false"); | ||
}); | ||
|
||
it("should return correct class name for items with OKAndSame status", () => { | ||
const item: IFileIndexItem = { | ||
isDirectory: false, | ||
status: IExifStatus.OkAndSame | ||
} as unknown as IFileIndexItem; | ||
expect(GetBoxClassName(item)).toBe("box isDirectory-false"); | ||
}); | ||
|
||
it("should return correct class name for items with error status", () => { | ||
const item: IFileIndexItem = { | ||
isDirectory: false, | ||
status: "SomeErrorStatus" | ||
} as unknown as IFileIndexItem; | ||
expect(GetBoxClassName(item)).toBe("box isDirectory-false error"); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
...sky/clientapp/src/components/molecules/item-text-list-view/internal/get-box-class-name.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { IFileIndexItem } from "../../../../interfaces/IFileIndexItem"; | ||
import { IExifStatus } from "../../../../interfaces/IExifStatus"; | ||
|
||
export function GetBoxClassName(item: IFileIndexItem): string { | ||
if (item.isDirectory) { | ||
return "box isDirectory-true"; | ||
} else if ( | ||
item.status === IExifStatus.Ok || | ||
item.status === IExifStatus.Default || | ||
item.status === IExifStatus.OkAndSame | ||
) { | ||
return "box isDirectory-false"; | ||
} else { | ||
return "box isDirectory-false error"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters