From 8341d1dd4660aff34a46432a446e90d1b5fa9ae7 Mon Sep 17 00:00:00 2001 From: anthonychengit Date: Wed, 26 Aug 2026 10:04:02 -0700 Subject: [PATCH] fix(frontend): disable repeat remove buttons --- .../formly/repeat-dnd/repeat-dnd.component.html | 4 ++-- .../formly/repeat-dnd/repeat-dnd.component.spec.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html b/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html index 13ef4386ac4..7f53df1c67f 100644 --- a/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html +++ b/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html @@ -21,7 +21,7 @@ cdkDropList (cdkDropListDropped)="onDrop($event)">
diff --git a/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts b/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts index 4589fa76ef7..2f0547f6396 100644 --- a/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts +++ b/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts @@ -149,6 +149,20 @@ describe("FormlyRepeatDndComponent", () => { expect(spy).toHaveBeenCalledWith(1); }); + it("locks every remove button for a disabled section", () => { + render({ disabled: true }); + + expect(removeButtons()).toHaveLength(3); + expect(removeButtons().every(button => button.getAttribute("disabled") !== null)).toBe(true); + }); + + it("leaves every remove button available otherwise", () => { + render({ disabled: false }); + + expect(removeButtons()).toHaveLength(3); + expect(removeButtons().every(button => button.getAttribute("disabled") === null)).toBe(true); + }); + it("appends a row from the add button", () => { const spy = vi.spyOn(component, "add").mockImplementation(() => {}); render();