diff --git a/src/collections/Form/FormField.js b/src/collections/Form/FormField.js index 5f7e60a72e..20244a05d1 100644 --- a/src/collections/Form/FormField.js +++ b/src/collections/Form/FormField.js @@ -74,7 +74,7 @@ function FormField(props) { // ---------------------------------------- // Checkbox/Radio Control // ---------------------------------------- - const controlProps = { ...rest, children, disabled, required, type } + const controlProps = { ...rest, content, children, disabled, required, type } // wrap HTML checkboxes/radios in the label if (control === 'input' && (type === 'checkbox' || type === 'radio')) { diff --git a/test/specs/collections/Form/FormField-test.js b/test/specs/collections/Form/FormField-test.js index 17a7f3dd6d..6e4fd4eda6 100644 --- a/test/specs/collections/Form/FormField-test.js +++ b/test/specs/collections/Form/FormField-test.js @@ -4,6 +4,7 @@ import React from 'react' import Radio from 'src/addons/Radio/Radio' import FormField from 'src/collections/Form/FormField' import { SUI } from 'src/lib' +import Button from 'src/elements/Button/Button' import Checkbox from 'src/modules/Checkbox/Checkbox' import * as common from 'test/specs/commonTests' @@ -113,4 +114,21 @@ describe('FormField', () => { input.should.have.prop('required', true) }) }) + + describe('content', () => { + it('is not set by default', () => { + const wrapper = shallow() + const button = wrapper.find('Button') + + wrapper.should.have.exactly(1).descendants('Button') + button.should.not.have.prop('content') + }) + it('is passed to the control', () => { + const wrapper = shallow() + const button = wrapper.find('Button') + + wrapper.should.have.exactly(1).descendants('Button') + button.should.have.prop('content', 'Click Me') + }) + }) })