From da8133c2a77c18afd0302dfc0ab47fa344902706 Mon Sep 17 00:00:00 2001 From: Benjamin Beret Date: Sat, 7 Jan 2017 19:50:59 +0100 Subject: [PATCH] Refactor tests --- test/test.FormsyText.js | 43 ++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/test/test.FormsyText.js b/test/test.FormsyText.js index a5bac23..aff7059 100644 --- a/test/test.FormsyText.js +++ b/test/test.FormsyText.js @@ -54,13 +54,15 @@ class TestForm extends Component { } render() { - const { value, defaultValue, ...extraProps } = { ...this.props, ...this.state }; + const { value, defaultValue, children, ...extraProps } = { ...this.props, ...this.state }; return (
- + {this.props.children ? this.props.children : ( + + )} ); } @@ -148,17 +150,32 @@ describe('FormsyText', () => { expect(formValues.text).to.eq('some text'); }); - it('disabled', () => { - const { formsyTextWrapper, formWrapper } = makeTestParent({ - disabled: true, - }); - - const formsyForm = formWrapper.find(Form).node; - expect(formsyForm.isFormDisabled()).to.eq(true); + it('propagates disabled status', () => { + const wrapper = mount( + + + + ); - const inputDOM = formsyTextWrapper.find('input').node; + const inputDOM = wrapper.find('input').node; expect(inputDOM.disabled).to.eq(true); }); + + it('allows overriding disabled status locally', () => { + const wrapper = mount( + + + + ); + + const inputDOM = wrapper.find('input').node; + expect(inputDOM.disabled).to.eq(false); + }); }); describe('updating', () => {