fix: if url is already https, toggle should be checked
This commit is contained in:
@@ -58,6 +58,18 @@ describe("HTTP Component", () => {
|
|||||||
expect(screen.getByText("http://")).toBeInTheDocument();
|
expect(screen.getByText("http://")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("enables HTTPS toggle when location protocol is https", () => {
|
||||||
|
Object.defineProperty(globalThis, "location", {
|
||||||
|
value: { protocol: "https:" },
|
||||||
|
writable: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
render(<HTTP closeDialog={vi.fn()} />);
|
||||||
|
|
||||||
|
const switchInput = screen.getByRole("switch");
|
||||||
|
expect(switchInput).toBeChecked();
|
||||||
|
});
|
||||||
|
|
||||||
it.skip("submits form and triggers connection process", () => {
|
it.skip("submits form and triggers connection process", () => {
|
||||||
// This will need further work to test, as it involves a lot of other plumbing mocking
|
// This will need further work to test, as it involves a lot of other plumbing mocking
|
||||||
const closeDialog = vi.fn();
|
const closeDialog = vi.fn();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export const HTTP = ({ closeDialog }: TabElementProps) => {
|
|||||||
<Switch
|
<Switch
|
||||||
onCheckedChange={setTLS}
|
onCheckedChange={setTLS}
|
||||||
disabled={location.protocol === "https:" || connectionInProgress}
|
disabled={location.protocol === "https:" || connectionInProgress}
|
||||||
checked={tlsValue}
|
checked={location.protocol === 'https:' || tlsValue}
|
||||||
{...register("tls")}
|
{...register("tls")}
|
||||||
/>
|
/>
|
||||||
<Label>Use HTTPS</Label>
|
<Label>Use HTTPS</Label>
|
||||||
|
|||||||
Reference in New Issue
Block a user