UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

29 lines (27 loc) 1.37 kB
"use strict"; /* tslint:disable:no-unused-variable */ var React = require('react'); /* tslint:enable:no-unused-variable */ var ReactTestUtils = require('react-addons-test-utils'); var ColorPicker_1 = require('./ColorPicker'); var expect = chai.expect; describe('ColorPicker', function () { it('Props are correctly parsed', function () { var component = ReactTestUtils.renderIntoDocument(React.createElement(ColorPicker_1.ColorPicker, {color: '#FFFFFF'})); expect(component.state.color.hex).to.equal('ffffff'); }); it('Reacts to props changes', function () { var component = ReactTestUtils.renderIntoDocument(React.createElement(ColorPicker_1.ColorPicker, {color: '#FFFFFF'})); component.componentWillReceiveProps({ color: '#AEAEAE' }); expect(component.state.color.hex).to.equal('aeaeae'); }); it('onColorChange is called', function () { var color = '#FFFFFF'; var component = ReactTestUtils.renderIntoDocument(React.createElement(ColorPicker_1.ColorPicker, {color: color, onColorChanged: function (str) { return color = str; }})); var newColor = '#AEAEAE'; component.componentWillReceiveProps({ color: newColor }); expect(component.state.color.hex).to.equal('aeaeae'); expect(color).to.equal(newColor); }); }); //# sourceMappingURL=ColorPicker.test.js.map