Skip to content

Commit

Permalink
Merge pull request #1783 from qdraw/feature/202410_upload_modal_oksam…
Browse files Browse the repository at this point in the history
…estatus

Feature/202410 upload modal oksamestatus
  • Loading branch information
qdraw authored Oct 24, 2024
2 parents 677a3ff + 0e4da05 commit 967ff2c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
3 changes: 2 additions & 1 deletion history.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ Semantic Versioning 2.0.0 is from version 0.1.6+
## List of versions

## version 0.6.3 - _(Unreleased)_ - 2024-08-?? {#v0.6.3}
- nothing

- [x] (Fixed) _Front-end_ OkAndSame status in Upload Modal gives the wrong status (PR #1783)

## version 0.6.2 - 2024-10-11 {#v0.6.2}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,39 @@ describe("ItemTextListView", () => {
);
});

const statusCorrectlyTheoryData = [
{ status: IExifStatus.OkAndSame, shouldShowError: false },
{ status: IExifStatus.ServerError, shouldShowError: true },
{ status: IExifStatus.NotFoundSourceMissing, shouldShowError: true },
{ status: IExifStatus.Ok, shouldShowError: false },
{ status: IExifStatus.ReadOnly, shouldShowError: true }
];

test.each(statusCorrectlyTheoryData)(
"error-status should render %s",
({ status, shouldShowError }) => {
const fileIndexItems = [
{
filePath: "/test/image.jpg",
fileName: "image.jpg",
status: status,
isDirectory: false
}
] as IFileIndexItem[];
const list = render(<ItemTextListView fileIndexItems={fileIndexItems} callback={() => {}} />);

const item = screen.queryByTestId("image.jpg-error-status");

if (shouldShowError) {
expect(item).toBeTruthy();
} else {
expect(item).toBeFalsy();
}

list.unmount();
}
);

it("list of 1 directory item", () => {
const fileIndexItems = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { FunctionComponent } from "react";
import useGlobalSettings from "../../../hooks/use-global-settings";
import { IExifStatus } from "../../../interfaces/IExifStatus";
import { IFileIndexItem } from "../../../interfaces/IFileIndexItem";
import localization from "../../../localization/localization.json";
import { Language } from "../../../shared/language";
import { FunctionComponent } from "react";
import { GetBoxClassName } from "./internal/get-box-class-name.ts";

interface ItemListProps {
Expand Down Expand Up @@ -51,8 +51,12 @@ const ItemTextListView: FunctionComponent<ItemListProps> = (props) => {
</button>
) : null}
{!item.isDirectory ? item.fileName : null}
{item.status !== IExifStatus.Ok && item.status !== IExifStatus.Default ? (
<em className="error-status">{item.status}</em>
{item.status !== IExifStatus.Ok &&
item.status !== IExifStatus.Default &&
item.status !== IExifStatus.OkAndSame ? (
<em data-test={item.fileName + "-error-status"} className="error-status">
{item.status}
</em>
) : null}
</li>
))}
Expand Down

1 comment on commit 967ff2c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.