Skip to content

Commit 4304469

Browse files
committed
fix: remove double disable class
1 parent 1524afa commit 4304469

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/FormsyRadioGroup.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class FormsyRadioGroup extends Component<IFormsyRadioGroupProps> {
8888
};
8989

9090
const fieldProps = {
91-
disabled,
9291
width,
9392
error: !disabled && error,
9493
};

test/FormsyRadioGroup.spec.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,6 @@ describe('<RadioGroup/>', () => {
114114
expect(labelField).toHaveClass('error');
115115
expect(labelField).toHaveTextContent('LABEL');
116116
});
117-
118-
it('should be disabled', () => {
119-
wrapper = renderTestForm({
120-
label: 'LABEL',
121-
disabled: true,
122-
});
123-
124-
const labelField = wrapper.container.querySelector('.field:first-child');
125-
126-
expect(labelField).toHaveClass('disabled');
127-
expect(labelField).toHaveTextContent('LABEL');
128-
});
129117
});
130118

131119
describe('Field', () => {
@@ -152,6 +140,19 @@ describe('<RadioGroup/>', () => {
152140
expect(fields).toHaveLength(3);
153141
Array.from(fields).forEach((field) => expect(field).toHaveClass('ten'));
154142
});
143+
144+
it('should not apply disabled on the field it self, prevent double disable', () => {
145+
wrapper = renderTestForm({
146+
disabled: true,
147+
});
148+
149+
const fields = wrapper.container.querySelectorAll('.field');
150+
151+
expect(fields).toHaveLength(3);
152+
Array.from(fields).forEach((field) =>
153+
expect(field).not.toHaveClass('disabled')
154+
);
155+
});
155156
});
156157

157158
describe('Field.Group', () => {

0 commit comments

Comments
 (0)