Skip to content

Commit

Permalink
Fix and test Material-style picker
Browse files Browse the repository at this point in the history
  • Loading branch information
islemaster committed May 11, 2016
1 parent 1bc5c91 commit dfcc2df
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/material/Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Material extends ReactCSS.Component {
return (
<Raised>
<div is="material">
<EditableInput is="Hex" label="hex" value={ '#' + this.props.hex } onChange={ this.handleChange } />
<EditableInput is="Hex" label="hex" value={ this.props.hex } onChange={ this.handleChange } />
<div is="split" className="flexbox-fix">
<div is="third">
<EditableInput is="Input" label="r" value={ this.props.rgb.r } onChange={ this.handleChange } />
Expand Down
22 changes: 22 additions & 0 deletions test/material/Material.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict'

import { React, ReactDOM, TestUtils, expect, chai, spies, defaultProps } from '../config'

import { Material } from '../../src/components/material/Material'
import { EditableInput } from '../../src/components/common'

let props

describe('Material', () => {

beforeEach(() => {
props = defaultProps
})

it('should render hex with only one hash', () => {
const MaterialComponent = TestUtils.renderIntoDocument(<Material {...props} />)
const hexInput = TestUtils.scryRenderedComponentsWithType(MaterialComponent, EditableInput)
.filter(input => input.props.label === 'hex')[0]
expect(hexInput.props.value).to.equal('#194d33')
})
})

0 comments on commit dfcc2df

Please sign in to comment.