Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(TextArea): rename and use functional component #409

Merged
merged 1 commit into from
Aug 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/addons/TextArea/TextArea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import { META } from '../../lib'

/**
* A simple <textarea> wrapper for use in Form.TextArea.
* We may add more features to the TextArea in the future.
* @see Form
*/
function TextArea(props) {
return <textarea {...props} />
}

TextArea._meta = {
name: 'TextArea',
type: META.TYPES.ADDON,
}

export default TextArea
20 changes: 0 additions & 20 deletions src/addons/Textarea/Textarea.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/addons/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as Confirm } from './Confirm/Confirm'
export { default as Radio } from './Radio/Radio'
export { default as Select } from './Select/Select'
export { default as Textarea } from './Textarea/Textarea'
export { default as TextArea } from './TextArea/TextArea'
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react'

import Textarea from 'src/addons/Textarea/Textarea'
import TextArea from 'src/addons/TextArea/TextArea'
import * as common from '../commonTests'

describe('Textarea', () => {
common.isConformant(Textarea)
describe('TextArea', () => {
common.isConformant(TextArea)

it('accepts a default value', () => {
const wrapper = mount(<Textarea defaultValue='Hello World' />)
const wrapper = mount(<TextArea defaultValue='Hello World' />)

wrapper
.should.have.have.exactly(1).descendants('textarea')
Expand All @@ -17,12 +17,12 @@ describe('Textarea', () => {
})

it('has a name assigned', () => {
shallow(<Textarea name='sample-post' />)
shallow(<TextArea name='sample-post' />)
.should.have.prop('name', 'sample-post')
})

it('has assigned amount of rows', () => {
shallow(<Textarea rows='6' />)
shallow(<TextArea rows='6' />)
.should.have.tagName('textarea')
.with.attr('rows', '6')
})
Expand Down