Skip to content

Commit

Permalink
fix(Warning): RadioButtonGroup warning added
Browse files Browse the repository at this point in the history
  • Loading branch information
Utzel-Butzel committed Nov 18, 2020
1 parent 59385b5 commit dd3ae6c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
7 changes: 5 additions & 2 deletions src/components/RadioButtonGroup/RadioButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import settings from '../../globals/js/settings';
const { prefix } = settings;

export default class RadioButtonGroup extends React.Component {
console.warn("RadioButtonGroup is depreciated and will be removed in the next versions. Use InputGroup instead");
state = { selected: this.props.valueSelected || this.props.defaultSelected };

static propTypes = {
Expand Down Expand Up @@ -92,7 +91,7 @@ export default class RadioButtonGroup extends React.Component {
}

getRadioButtons = () => {
const children = React.Children.map(this.props.children, radioButton => {
const children = React.Children.map(this.props.children, (radioButton) => {
const { value, ...other } = radioButton.props;
/* istanbul ignore if */
if (radioButton.props.hasOwnProperty('checked')) {
Expand Down Expand Up @@ -153,6 +152,10 @@ export default class RadioButtonGroup extends React.Component {
<div className="wfp--form__helper-text">{helperText}</div>
) : null;

console.warn(
'RadioButtonGroup is depreciated and will be removed in the next versions. Use InputGroup instead'
);

return (
<div className={wrapperClasses}>
<div className={className} disabled={disabled}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from 'react';
import classNames from 'classnames';

export default class FormWizard extends React.Component {
console.warn("RadioButtonGroup is depreciated and will be removed in the next versions. Use InputGroup instead");
static propTypes = {
/**
* Specify a custom css class
Expand Down Expand Up @@ -31,6 +30,10 @@ export default class FormWizard extends React.Component {
formControls: classNames('wfp--form-wizard', className),
};

console.warn(
'RadioButtonGroup is depreciated and will be removed in the next versions. Use InputGroup instead'
);

return (
<div className={classes.formControls}>
<div className="wfp--form-wizard__sidebar">{sidebar}</div>
Expand Down
19 changes: 13 additions & 6 deletions src/components/Select/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@ describe('Select', () => {
id="testing"
labelText="Select"
className="extra-class"
helperText="Helper text">
helperText="Helper text"
required>
<SelectItem />
<SelectItem />
</Select>
);

const selectContainer = wrapper.find('.wfp--form-item > div');
const selectContainer = wrapper.find(
'.wfp--form-item > .wfp--input-wrapper'
);
const label = wrapper.find('label');
const select = wrapper.find('select');
const selectWrapper = wrapper.find('.wfp--select');
const helper = wrapper.find('.wfp--form__helper-text');

describe('selectContainer', () => {
it('renders a container', () => {
debugger;
expect(selectContainer.length).toEqual(1);
});

Expand All @@ -41,11 +46,11 @@ describe('Select', () => {
});

it('has the expected classes', () => {
expect(selectContainer.hasClass('wfp--select')).toEqual(true);
expect(selectWrapper.hasClass('wfp--select')).toEqual(true);
});

it('applies extra classes specified via className', () => {
expect(selectContainer.hasClass('extra-class')).toEqual(true);
expect(selectWrapper.hasClass('extra-class')).toEqual(true);
});

it('has the expected default iconDescription', () => {
Expand Down Expand Up @@ -114,7 +119,7 @@ describe('Select', () => {
});

it('renders children as expected', () => {
expect(label.props().children).toEqual('Select');
expect(label.props().children).toEqual(['Select', '*']);
});
});

Expand Down Expand Up @@ -155,9 +160,11 @@ describe('Select', () => {

const selectContainer = wrapper.find('.wfp--form-item > div');

/* TODO: add inline to Input component
it('has the expected classes', () => {
expect(selectContainer.hasClass('wfp--select--inline')).toEqual(true);
});
});*/
});
});

Expand Down
4 changes: 3 additions & 1 deletion src/components/TextInput/TextInput-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ describe('TextInput', () => {
/>
);

const input = wrapper.find('input');
const input = wrapper.children();

console.log(input);

it('should not invoke onClick', () => {
input.simulate('click');
Expand Down
2 changes: 1 addition & 1 deletion src/globals/scss/_css--typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
strong,
.#{$prefix}--type-strong {
@include reset;
font-weight: 700;
font-weight: 600;
}

p {
Expand Down

0 comments on commit dd3ae6c

Please sign in to comment.