Skip to content

Commit

Permalink
update supported-platforms page (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdams authored Mar 12, 2024
1 parent 9e38ebe commit 5d6355f
Show file tree
Hide file tree
Showing 35 changed files with 1,365 additions and 328 deletions.
107 changes: 0 additions & 107 deletions content/asciidoc-pages/supported-platforms/index.adoc

This file was deleted.

56 changes: 31 additions & 25 deletions src/components/ChecksumModal/__tests__/ChecksumModal.test.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,65 @@
import React from "react";
import userEvent from "@testing-library/user-event";
import { render, screen, act } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import ChecksumModal from ".."; // Ensure this import path is correct
import React from "react"
import userEvent from "@testing-library/user-event"
import { render, screen, act } from "@testing-library/react"
import { describe, expect, it, vi } from "vitest"
import ChecksumModal from ".." // Ensure this import path is correct

// Setup for navigator.clipboard mock
Object.assign(navigator, {
clipboard: {
writeText: vi.fn(),
},
});
})

window.ResizeObserver = vi.fn().mockImplementation(() => ({
observe: vi.fn(),
unobserve: vi.fn(),
disconnect: vi.fn(),
}));
}))

const navigatorClipboardSpy = vi.spyOn(navigator.clipboard, "writeText");
const navigatorClipboardSpy = vi.spyOn(navigator.clipboard, "writeText")

describe("ChecksumModal component", () => {
// Providing the required props for the component to render correctly
const requiredProps = {
open: true,
setOpen: vi.fn(), // Mocking setOpen function
checksum: "exampleChecksumValue",
};
}

it("ChecksumModal renders correctly", () => {
const { container } = render(<ChecksumModal open={true} setOpen={() => {}} checksum="exampleChecksumValue" />);
const { container } = render(
<ChecksumModal
open={true}
setOpen={() => {}}
checksum="exampleChecksumValue"
/>,
)
// wait for the component to be in the document
expect(screen.getByText("Checksum (SHA256)")).toBeInTheDocument();
expect(screen.getByText("Checksum (SHA256)")).toBeInTheDocument()
// Find the input field by its role and ensure it's in the document
const inputField = screen.getByRole('textbox');
expect(inputField).toBeInTheDocument();
const inputField = screen.getByRole("textbox")
expect(inputField).toBeInTheDocument()

// Assert that the input field has the correct value
expect(inputField).toHaveValue('exampleChecksumValue');
expect(container).toMatchSnapshot();
});
expect(inputField).toHaveValue("exampleChecksumValue")
expect(container).toMatchSnapshot()
})

it("ChecksumModal copies correctly", async () => {
render(<ChecksumModal {...requiredProps} />);
navigatorClipboardSpy.mockImplementationOnce(() => Promise.resolve());
render(<ChecksumModal {...requiredProps} />)
navigatorClipboardSpy.mockImplementationOnce(() => Promise.resolve())

// Using act to wait for all state updates and effects to finish
await act(async () => {
userEvent.click(screen.getByText("Copy"));
});
userEvent.click(screen.getByText("Copy"))
})

// Since the text changes to "Copied" after the button is clicked and state is updated,
// we need to ensure the component has re-rendered with the new state
await screen.findByText("Copied");
await screen.findByText("Copied")

expect(navigatorClipboardSpy).toHaveBeenCalledTimes(1);
expect(navigatorClipboardSpy).toHaveBeenCalledWith("exampleChecksumValue");
});
});
expect(navigatorClipboardSpy).toHaveBeenCalledTimes(1)
expect(navigatorClipboardSpy).toHaveBeenCalledWith("exampleChecksumValue")
})
})
26 changes: 13 additions & 13 deletions src/components/Common/AppIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ export const DownloadIcon = () => {
d="M17.5 12.5V15.8333C17.5 16.2754 17.3244 16.6993 17.0118 17.0118C16.6993 17.3244 16.2754 17.5 15.8333 17.5H4.16667C3.72464 17.5 3.30072 17.3244 2.98816 17.0118C2.67559 16.6993 2.5 16.2754 2.5 15.8333V12.5"
stroke="white"
className="group-hover:stroke-primary group-hover:transition-all group-hover:duration-300 group-hover:ease-in-out"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M5.83203 8.33301L9.9987 12.4997L14.1654 8.33301"
stroke="white"
className="group-hover:stroke-primary group-hover:transition-all group-hover:duration-300 group-hover:ease-in-out"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M10 12.5V2.5"
stroke="white"
className="group-hover:stroke-primary group-hover:transition-all group-hover:duration-300 group-hover:ease-in-out"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</>
Expand Down Expand Up @@ -195,8 +195,8 @@ export const OperaIcon = () => {
y2="30.6159"
gradientUnits="userSpaceOnUse"
>
<stop stop-color="#85D888" />
<stop offset="1" stop-color="#56A458" />
<stop stopColor="#85D888" />
<stop offset="1" stopColor="#56A458" />
</linearGradient>
<linearGradient
id="paint1_linear_1_15754"
Expand All @@ -206,8 +206,8 @@ export const OperaIcon = () => {
y2="31.9999"
gradientUnits="userSpaceOnUse"
>
<stop stop-color="#56A458" />
<stop offset="1" stop-color="#85D888" />
<stop stopColor="#56A458" />
<stop offset="1" stopColor="#85D888" />
</linearGradient>
</defs>
</svg>
Expand Down
Loading

0 comments on commit 5d6355f

Please sign in to comment.