Skip to content

Commit

Permalink
adds missing test for setting cva.disabled <=> control.disabled sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Robby Rabbitman committed Feb 18, 2025
1 parent 0c98813 commit 3346cdc
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ describe('NgxControlValueAccessor', () => {
expect(cva.disabled).toEqual(true);
expect(input.disabled).toEqual(true);

// verify sync of control.disabled => cva.disabled
params.control.enable();
fixture.detectChanges();

Expand All @@ -370,6 +371,7 @@ describe('NgxControlValueAccessor', () => {
expect(cva.disabled).toEqual(true);
expect(input.disabled).toEqual(true);

// verify sync of cva.disabled => control.disabled
cva.disabled = false;
fixture.detectChanges();
expect(params.control.disabled).toEqual(false);
Expand Down Expand Up @@ -450,6 +452,7 @@ describe('NgxControlValueAccessor', () => {
expect(cva.disabled).toEqual(true);
expect(input.disabled).toEqual(true);

// verify sync of control.disabled => cva.disabled
ngControl?.control!.enable();
fixture.detectChanges();

Expand All @@ -461,6 +464,17 @@ describe('NgxControlValueAccessor', () => {

expect(cva.disabled).toEqual(true);
expect(input.disabled).toEqual(true);

// verify sync of cva.disabled => control.disabled
cva.disabled = false;
fixture.detectChanges();
expect(ngControl?.disabled).toEqual(false);
expect(input.disabled).toEqual(false);

cva.disabled = true;
fixture.detectChanges();
expect(ngControl?.disabled).toEqual(true);
expect(input.disabled).toEqual(true);
});
});
});
Expand Down

0 comments on commit 3346cdc

Please # to comment.