Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
cdkDropList
(cdkDropListDropped)="onDrop($event)">
<div
*ngFor="let field of field.fieldGroup; let i = index"
*ngFor="let row of field.fieldGroup; let i = index"
cdkDrag
class="dnd-row">
<div
Expand All @@ -35,7 +35,7 @@

<div class="dnd-field-wrapper">
<formly-field
*ngFor="let subField of field.fieldGroup"
*ngFor="let subField of row.fieldGroup"
class="dnd-field"
[field]="subField"></formly-field>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading