Skip to content
Snippets Groups Projects
Unverified Commit 2067dba5 authored by Ariya Hidayat's avatar Ariya Hidayat Committed by GitHub
Browse files

Allow firing an event (e.g. clicking) on the checkbox's label (#22488)

parent be61433b
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ function CheckboxTooltip({
const CheckBox = forwardRef<HTMLLabelElement, CheckBoxProps>(function Checkbox(
{
name,
label,
labelEllipsis = false,
checked,
......@@ -74,6 +75,7 @@ const CheckBox = forwardRef<HTMLLabelElement, CheckBoxProps>(function Checkbox(
onChange={isControlledCheckBoxInput ? onChange : undefined}
onFocus={onFocus}
onBlur={onBlur}
id={name}
/>
<CheckBoxContainer disabled={disabled}>
<CheckBoxIconContainer
......
......@@ -26,6 +26,7 @@ export interface CheckBoxLabelProps {
export interface CheckBoxProps
extends Omit<HTMLAttributes<HTMLElement>, "onChange" | "onFocus" | "onBlur"> {
name?: string;
label?: ReactNode;
labelEllipsis?: boolean;
checked?: boolean;
......
......@@ -53,6 +53,16 @@ describe("scenarios > auth > signin", () => {
cy.contains(/[a-z ]+, Bob/i);
});
it("should allow toggling of Remember Me", () => {
cy.visit("/auth/login");
// default initial state
cy.findByRole("checkbox").should("be.checked");
cy.findByLabelText("Remember me").click();
cy.findByRole("checkbox").should("not.be.checked");
});
it("should redirect to a unsaved question after login", () => {
cy.signInAsAdmin();
cy.visit("/");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment