Skip to content

Commit

Permalink
Merge pull request #383 from appfolio/correctFormLabelGroup
Browse files Browse the repository at this point in the history
gt - Correct required indicator
  • Loading branch information
gthomas-appfolio authored Apr 6, 2018
2 parents 2306207 + 1b7c48e commit ffd3927
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/FormLabelGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import FormGroup from './FormGroup';
import FormText from './FormText';
import FormFeedback from './FormFeedback';
import Label from './Label';
import Required from './Required';
import Row from './Row';

const FormLabelGroup = (props) => {
Expand Down Expand Up @@ -32,7 +33,7 @@ const FormLabelGroup = (props) => {
{label && (
<Label for={inputId} sm={labelWidth} size={size} className={labelAlignment}>
{label}
{required && label ? <span className="text-danger">&nbsp;*</span> : null}
{required && label ? <Required /> : null}
</Label>
)}
<Col sm={inputContainerWidth}>
Expand Down
1 change: 1 addition & 0 deletions src/components/FormRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const FormRow = (props) => {

const inputContainerWidth = stacked ? 12 : 9;

// TODO this should use FormLabelGroup vs duplicated code here:
return (
<FormGroup
row
Expand Down
4 changes: 2 additions & 2 deletions test/components/FormLabelGroup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ describe('<FormLabelGroup />', () => {
assert.equal(label.length, 1);
const labelChildren = label.children();
assert.equal(labelChildren.at(0).text(), 'First Name');
assert.equal(labelChildren.at(1).text(), ' *');
assert.equal(labelChildren.at(1).prop('className'), 'text-danger');
const star = label.find('Required');
assert.equal(star.length, 1);
});
});

Expand Down

0 comments on commit ffd3927

Please sign in to comment.