From a1ccf6949b06e6ba5decdc29916ef8be3cd071a1 Mon Sep 17 00:00:00 2001 From: Mirco Zeiss Date: Thu, 12 Jan 2017 10:46:13 +0100 Subject: [PATCH] add test for htmlFor to textfield and textarea --- src/js/textfield/index.js | 4 ++-- src/js/textfield/test/test.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/js/textfield/index.js b/src/js/textfield/index.js index 9a489485a..9e1605a64 100644 --- a/src/js/textfield/index.js +++ b/src/js/textfield/index.js @@ -57,7 +57,7 @@ const TextfieldWrapper = ({ ) } -export const Textfield = ({float, error, length, ...rest}) => ( +export const Textfield = ({float, error, length, htmlFor, ...rest}) => ( ( label={rest.label} value={rest.value} length={length} - htmlFor={rest.htmlFor} + htmlFor={htmlFor} > { const wrapper = mount() assert.equal(wrapper.find('.Textfield-input').node.type, 'password') }) + + it('should allow setting the htmlFor attribute on label element', () => { + const wrapper = mount() + assert.equal(wrapper.find('label').node.htmlFor, 'foo') + }) }) describe('Textarea', () => { @@ -168,5 +173,10 @@ describe('Textarea', () => { wrapper.find('textarea').simulate('input', {target}) assert.equal(target.style.height, '30px') }) + + it('should allow setting the htmlFor attribute on label element', () => { + const wrapper = mount(