Skip to content

Commit

Permalink
fix: remove double disable class
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Jul 27, 2023
1 parent 1524afa commit 4304469
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/FormsyRadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class FormsyRadioGroup extends Component<IFormsyRadioGroupProps> {
};

const fieldProps = {
disabled,
width,
error: !disabled && error,
};
Expand Down
25 changes: 13 additions & 12 deletions test/FormsyRadioGroup.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,6 @@ describe('<RadioGroup/>', () => {
expect(labelField).toHaveClass('error');
expect(labelField).toHaveTextContent('LABEL');
});

it('should be disabled', () => {
wrapper = renderTestForm({
label: 'LABEL',
disabled: true,
});

const labelField = wrapper.container.querySelector('.field:first-child');

expect(labelField).toHaveClass('disabled');
expect(labelField).toHaveTextContent('LABEL');
});
});

describe('Field', () => {
Expand All @@ -152,6 +140,19 @@ describe('<RadioGroup/>', () => {
expect(fields).toHaveLength(3);
Array.from(fields).forEach((field) => expect(field).toHaveClass('ten'));
});

it('should not apply disabled on the field it self, prevent double disable', () => {
wrapper = renderTestForm({
disabled: true,
});

const fields = wrapper.container.querySelectorAll('.field');

expect(fields).toHaveLength(3);
Array.from(fields).forEach((field) =>
expect(field).not.toHaveClass('disabled')
);
});
});

describe('Field.Group', () => {
Expand Down

0 comments on commit 4304469

Please sign in to comment.