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();
|
||||
});
|
||||
|
||||
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", () => {
|
||||
// This will need further work to test, as it involves a lot of other plumbing mocking
|
||||
const closeDialog = vi.fn();
|
||||
|
||||
@@ -70,7 +70,7 @@ export const HTTP = ({ closeDialog }: TabElementProps) => {
|
||||
<Switch
|
||||
onCheckedChange={setTLS}
|
||||
disabled={location.protocol === "https:" || connectionInProgress}
|
||||
checked={tlsValue}
|
||||
checked={location.protocol === 'https:' || tlsValue}
|
||||
{...register("tls")}
|
||||
/>
|
||||
<Label>Use HTTPS</Label>
|
||||
|
||||
Reference in New Issue
Block a user