Skip to content

Commit

Permalink
refactor(Textarea): rename TextArea, add doc block
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Aug 21, 2016
1 parent 5a7fdc0 commit 9074a2b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
30 changes: 14 additions & 16 deletions src/addons/Textarea/Textarea.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import React, { Component, PropTypes } from 'react'
import React from 'react'
import { META } from '../../lib'

export default class Textarea extends Component {
static propTypes = {
className: PropTypes.string,
label: PropTypes.string,
}

static _meta = {
name: 'Textarea',
type: META.TYPES.ADDON,
}
/**
* 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} />
}

render() {
return (
<textarea {...this.props} />
)
}
TextArea._meta = {
name: 'TextArea',
type: META.TYPES.ADDON,
}

export default TextArea
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

0 comments on commit 9074a2b

Please sign in to comment.