Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
feat(appointments) reason field no longer labelled as a required (#2003)
Browse files Browse the repository at this point in the history
  • Loading branch information
JDarke authored Apr 23, 2020
1 parent 88ec61c commit d5a16b1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ describe('text field with label form group', () => {
expect(label.prop('text')).toEqual(expectedName)
})

it('should render label as required if isRequired is true', () => {
const expectedName = 'test'
const expectedRequired = true
const wrapper = shallow(
<TextFieldWithLabelFormGroup
name={expectedName}
label="test"
value=""
isEditable
isRequired={expectedRequired}
onChange={jest.fn()}
/>,
)

const label = wrapper.find(Label)
expect(label).toHaveLength(1)
expect(label.prop('isRequired')).toBeTruthy()
})

it('should render a text field', () => {
const expectedName = 'test'
const wrapper = shallow(
Expand Down
4 changes: 2 additions & 2 deletions src/components/input/TextFieldWithLabelFormGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ interface Props {
}

const TextFieldWithLabelFormGroup = (props: Props) => {
const { value, label, name, isEditable, isInvalid, feedback, onChange } = props
const { value, label, name, isEditable, isInvalid, isRequired, feedback, onChange } = props
const id = `${name}TextField`
return (
<div className="form-group">
<Label text={label} htmlFor={id} isRequired />
<Label text={label} htmlFor={id} isRequired={isRequired} />
<TextField
rows={4}
value={value}
Expand Down

1 comment on commit d5a16b1

@vercel
Copy link

@vercel vercel bot commented on d5a16b1 Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.