From fb2ebc63cedab7b9d6cfdd2a2724e6380199f210 Mon Sep 17 00:00:00 2001 From: Robert Kuykendall Date: Sat, 22 Jun 2019 17:37:23 -0400 Subject: [PATCH] Switch to Enzyme for testing (#167) --- .prettierrc | 2 +- __tests__/Formsy-spec.js | 283 ++++++++---------- __tests__/Rules-equals-spec.js | 65 ++--- __tests__/Rules-isAlpha-spec.js | 77 ++--- __tests__/Rules-isAlphanumeric-spec.js | 86 ++---- __tests__/Rules-isEmail-spec.js | 86 ++---- __tests__/Rules-isEmptyString-spec.js | 73 ++--- __tests__/Rules-isExisty-spec.js | 73 ++--- __tests__/Rules-isFloat-spec.js | 113 +++----- __tests__/Rules-isInt-spec.js | 113 +++----- __tests__/Rules-isLength-spec.js | 180 ++++-------- __tests__/Rules-isNumeric-spec.js | 113 +++----- __tests__/Rules-isUrl-spec.js | 75 ++--- __tests__/Rules-isWords-spec.js | 75 ++--- __tests__/Rules-maxLength-spec.js | 82 ++---- __tests__/Rules-minLength-spec.js | 147 +++------- lib/Wrapper.js | 113 +++----- lib/index.js | 114 ++------ lib/utils.js | 47 +-- lib/validationRules.js | 12 +- package.json | 21 +- setupTests.js | 4 + webpack.config.js | 19 +- yarn.lock | 381 ++++++++++++++++++++++++- 24 files changed, 992 insertions(+), 1362 deletions(-) create mode 100644 setupTests.js diff --git a/.prettierrc b/.prettierrc index 90f71115..4b9a2d97 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { - "print-width": "120", + "printWidth": 120, "singleQuote": true, "trailingComma": "all" } diff --git a/__tests__/Formsy-spec.js b/__tests__/Formsy-spec.js index 0edddb0a..1501a8bd 100755 --- a/__tests__/Formsy-spec.js +++ b/__tests__/Formsy-spec.js @@ -1,6 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import TestUtils from 'react-dom/test-utils'; +import { mount } from 'enzyme'; import Formsy, { addValidationRule } from './..'; import TestInput from '../__test_utils__/TestInput'; @@ -17,7 +18,7 @@ describe('Setting up a form', () => { { - this.name = c; + this.inputRef = c; }} /> @@ -25,21 +26,19 @@ describe('Setting up a form', () => { } } - const form = TestUtils.renderIntoDocument(); - const input = form.name; - expect(input.methodOnWrappedInstance('foo')).toEqual('foo'); + const form = mount(); + const input = form.instance().inputRef; + expect(input.props.name).toEqual('name'); }); it('should render a form into the document', () => { - const form = TestUtils.renderIntoDocument(); - expect(ReactDOM.findDOMNode(form).tagName).toEqual('FORM'); + const form = mount(); + expect(form.find('form').name()).toEqual('form'); }); it('should set a class name if passed', () => { - const form = TestUtils.renderIntoDocument( - , - ); - expect(ReactDOM.findDOMNode(form).className).toEqual('foo'); + const form = mount(); + expect(form.find('form').hasClass('foo')).toBe(true); }); it('should allow for null/undefined children', () => { @@ -57,9 +56,8 @@ describe('Setting up a form', () => { } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); immediate(() => { - TestUtils.Simulate.submit(ReactDOM.findDOMNode(form)); expect(model).toEqual({ name: 'foo' }); }); }); @@ -73,12 +71,10 @@ describe('Setting up a form', () => { forceUpdate = this.forceUpdate.bind(this); } render() { - return ( - (model = formModel)}>{inputs} - ); + return (model = formModel)}>{inputs}; } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); // Wait before adding the input setTimeout(() => { @@ -87,7 +83,7 @@ describe('Setting up a form', () => { forceUpdate(() => { // Wait for next event loop, as that does the form immediate(() => { - TestUtils.Simulate.submit(ReactDOM.findDOMNode(form)); + form.simulate('submit'); test.ok('test' in model); }); }); @@ -103,12 +99,10 @@ describe('Setting up a form', () => { forceUpdate = this.forceUpdate.bind(this); } render() { - return ( - (model = formModel)}>{inputs} - ); + return (model = formModel)}>{inputs}; } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); // Wait before adding the input immediate(() => { @@ -117,13 +111,10 @@ describe('Setting up a form', () => { forceUpdate(() => { // Wait for next event loop, as that does the form immediate(() => { - TestUtils.Simulate.change( - TestUtils.findRenderedDOMComponentWithTag(form, 'INPUT'), - { - target: { value: 'foo' }, - }, - ); - TestUtils.Simulate.submit(ReactDOM.findDOMNode(form)); + form.find('input').simulate({ + target: { value: 'foo' }, + }); + form.simulate('submit'); expect(model.test).toEqual('foo'); }); }); @@ -141,21 +132,19 @@ describe('Setting up a form', () => { render() { const input = ; - return ( - (model = formModel)}>{input} - ); + return (model = formModel)}>{input}; } } - let form = TestUtils.renderIntoDocument(); + let form = mount(); // Wait before changing the input immediate(() => { - form = TestUtils.renderIntoDocument(); + form = mount(); forceUpdate(() => { // Wait for next event loop, as that does the form immediate(() => { - TestUtils.Simulate.submit(ReactDOM.findDOMNode(form)); + form.simulate('submit'); expect(model.test).toEqual('bar'); }); }); @@ -171,14 +160,14 @@ describe('validations', () => { addValidationRule('runRule', runRule); addValidationRule('notRunRule', notRunRule); - const form = TestUtils.renderIntoDocument( + const form = mount( , ); - const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input'); - TestUtils.Simulate.change(ReactDOM.findDOMNode(input), { + const input = form.find('input'); + input.simulate('change', { target: { value: 'bar' }, }); expect(runRule.calledWith({ one: 'bar' })).toBe(true); @@ -210,10 +199,10 @@ describe('validations', () => { } } - const form = TestUtils.renderIntoDocument(); - form.changeRule(); - const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input'); - TestUtils.Simulate.change(ReactDOM.findDOMNode(input), { + const form = mount(); + form.instance().changeRule(); + const input = form.find('input'); + input.simulate('change', { target: { value: 'bar' }, }); expect(ruleB.calledWith({ one: 'bar' })).toBe(true); @@ -236,18 +225,16 @@ describe('validations', () => { return ( - {this.state.showSecondInput ? ( - - ) : null} + {this.state.showSecondInput ? : null} ); } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); - expect(form.refs.formsy.state.isValid).toEqual(true); - form.addInput(); + expect(form.instance().refs.formsy.state.isValid).toEqual(true); + form.instance().addInput(); immediate(() => { expect(isInValidSpy.called).toEqual(true); @@ -271,18 +258,16 @@ describe('validations', () => { return ( - {this.state.showSecondInput ? ( - - ) : null} + {this.state.showSecondInput ? : null} ); } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); - expect(form.refs.formsy.state.isValid).toEqual(false); - form.removeInput(); + expect(form.instance().refs.formsy.state.isValid).toEqual(false); + form.instance().removeInput(); immediate(() => { expect(isValidSpy.called).toEqual(true); @@ -295,14 +280,14 @@ describe('validations', () => { addValidationRule('ruleA', ruleA); addValidationRule('ruleB', ruleB); - const form = TestUtils.renderIntoDocument( + const form = mount( , ); - const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input'); - TestUtils.Simulate.change(ReactDOM.findDOMNode(input), { + const input = form.find('input'); + input.simulate('change', { target: { value: 'bar' }, }); expect(ruleA.calledWith({ one: 'bar' })).toBe(true); @@ -318,21 +303,18 @@ describe('onChange', () => { return ; } } - TestUtils.renderIntoDocument(); + mount(); expect(hasChanged.called).toEqual(false); }); it('should trigger onChange once when form element is changed', () => { const hasChanged = sinon.spy(); - const form = TestUtils.renderIntoDocument( + const form = mount( , ); - TestUtils.Simulate.change( - TestUtils.findRenderedDOMComponentWithTag(form, 'INPUT'), - { target: { value: 'bar' } }, - ); + form.find('input').simulate('change', { target: { value: 'bar' } }); expect(hasChanged.calledOnce).toEqual(true); }); @@ -348,16 +330,12 @@ describe('onChange', () => { }); } render() { - return ( - - {this.state.showInput ? : null} - - ); + return {this.state.showInput ? : null}; } } - const form = TestUtils.renderIntoDocument(); - form.addInput(); + const form = mount(); + form.instance().addInput(); immediate(() => { expect(hasChanged.calledOnce).toEqual(true); }); @@ -377,16 +355,14 @@ describe('onChange', () => { render() { return ( - {this.state.showInput ? ( - - ) : null} + {this.state.showInput ? : null} ); } } - const form = TestUtils.renderIntoDocument(); - form.addInput(); + const form = mount(); + form.instance().addInput(); immediate(() => { expect(hasChanged.args[0][0]).toEqual({ parent: { child: 'test' } }); }); @@ -409,13 +385,13 @@ describe('Update a form', () => { } } - const form = TestUtils.renderIntoDocument(); - const input = TestUtils.findRenderedComponentWithType(form, TestInput); - expect(input.isFormDisabled()).toEqual(true); + const form = mount(); + const input = form.find(TestInput); + expect(input.instance().isFormDisabled()).toEqual(true); - form.enableForm(); + form.instance().enableForm(); immediate(() => { - expect(input.isFormDisabled()).toEqual(false); + expect(input.instance().isFormDisabled()).toEqual(false); }); }); @@ -423,34 +399,27 @@ describe('Update a form', () => { class TestForm extends React.Component { state = { validationErrors: { foo: 'bar' } }; onChange = values => { - this.setState( - values.foo - ? { validationErrors: {} } - : { validationErrors: { foo: 'bar' } }, - ); + this.setState(values.foo ? { validationErrors: {} } : { validationErrors: { foo: 'bar' } }); }; render() { return ( - + ); } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); // Wait for update immediate(() => { - const input = TestUtils.findRenderedComponentWithType(form, TestInput); - expect(input.getErrorMessage()).toEqual('bar'); + const input = form.find(TestInput); + expect(input.instance().getErrorMessage()).toEqual('bar'); input.setValue('gotValue'); // Wait for update immediate(() => { - expect(input.getErrorMessage()).toEqual(null); + expect(input.instance().getErrorMessage()).toEqual(null); }); }); }); @@ -466,9 +435,9 @@ describe('Update a form', () => { ); } } - const form = TestUtils.renderIntoDocument(); - const FoundForm = TestUtils.findRenderedComponentWithType(form, TestForm); - TestUtils.Simulate.submit(ReactDOM.findDOMNode(FoundForm)); + const form = mount(); + const FoundForm = form.find(TestForm); + FoundForm.simulate('submit'); expect(isCalled.called).toEqual(true); }); @@ -483,10 +452,10 @@ describe('Update a form', () => { ); } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); - const FoundForm = TestUtils.findRenderedComponentWithType(form, TestForm); - TestUtils.Simulate.submit(ReactDOM.findDOMNode(FoundForm)); + const FoundForm = form.find(TestForm); + FoundForm.simulate('submit'); expect(isCalled.called).toEqual(true); }); }); @@ -505,8 +474,8 @@ describe('value === false', () => { } } - const form = TestUtils.renderIntoDocument(); - TestUtils.Simulate.submit(ReactDOM.findDOMNode(form)); + const form = mount(); + form.simulate('submit'); expect(onSubmit.calledWith({ foo: false })).toEqual(true); }); @@ -531,9 +500,9 @@ describe('value === false', () => { } } - const form = TestUtils.renderIntoDocument(); - form.changeValue(); - TestUtils.Simulate.submit(ReactDOM.findDOMNode(form)); + const form = mount(); + form.instance().changeValue(); + form.simulate('submit'); expect(onSubmit.calledWith({ foo: false })).toEqual(true); }); @@ -548,11 +517,11 @@ describe('value === false', () => { ); } } - const form = TestUtils.renderIntoDocument(); - const input = TestUtils.findRenderedComponentWithType(form, TestInput); - expect(input.isFormSubmitted()).toEqual(false); - TestUtils.Simulate.submit(ReactDOM.findDOMNode(form)); - expect(input.isFormSubmitted()).toEqual(true); + const form = mount(); + const input = form.find(TestInput); + expect(input.instance().isFormSubmitted()).toEqual(false); + form.simulate('submit'); + expect(input.instance().isFormSubmitted()).toEqual(true); }); it('should be able to reset the form to its pristine state', () => { @@ -574,14 +543,14 @@ describe('value === false', () => { ); } } - const form = TestUtils.renderIntoDocument(); - const input = TestUtils.findRenderedComponentWithType(form, TestInput); - const formsyForm = TestUtils.findRenderedComponentWithType(form, Formsy); - expect(input.getValue()).toEqual(true); - form.changeValue(); - expect(input.getValue()).toEqual(false); - formsyForm.reset(); - expect(input.getValue()).toEqual(true); + const form = mount(); + const input = form.find(TestInput); + const formsyForm = form.find(Formsy); + expect(input.instance().getValue()).toEqual(true); + form.instance().changeValue(); + expect(input.instance().getValue()).toEqual(false); + formsyForm.instance().reset(); + expect(input.instance().getValue()).toEqual(true); }); it('should be able to reset the form using custom data', () => { @@ -603,17 +572,17 @@ describe('value === false', () => { ); } } - const form = TestUtils.renderIntoDocument(); - const input = TestUtils.findRenderedComponentWithType(form, TestInput); - const formsyForm = TestUtils.findRenderedComponentWithType(form, Formsy); - - expect(input.getValue()).toEqual(true); - form.changeValue(); - expect(input.getValue()).toEqual(false); - formsyForm.reset({ + const form = mount(); + const input = form.find(TestInput); + const formsyForm = form.find(Formsy); + + expect(input.instance().getValue()).toEqual(true); + form.instance().changeValue(); + expect(input.instance().getValue()).toEqual(false); + formsyForm.instance().reset({ foo: 'bar', }); - expect(input.getValue()).toEqual('bar'); + expect(input.instance().getValue()).toEqual('bar'); }); }); @@ -629,61 +598,61 @@ describe('.reset()', () => { ); } } - const form = TestUtils.renderIntoDocument(); - const input = TestUtils.findRenderedComponentWithType(form, TestInput); - const formsyForm = TestUtils.findRenderedComponentWithType(form, Formsy); + const form = mount(); + const input = form.find(TestInput); + const formsyForm = form.find(Formsy); - formsyForm.reset({ + formsyForm.instance().reset({ foo: '', }); - expect(input.getValue()).toEqual(''); + expect(input.instance().getValue()).toEqual(''); }); }); describe('.isChanged()', () => { it('initially returns false', () => { const hasOnChanged = sinon.spy(); - const form = TestUtils.renderIntoDocument( + const form = mount( , ); - expect(form.isChanged()).toEqual(false); + expect(form.instance().isChanged()).toEqual(false); expect(hasOnChanged.called).toEqual(false); }); it('returns true when changed', () => { const hasOnChanged = sinon.spy(); - const form = TestUtils.renderIntoDocument( + const form = mount( , ); - const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input'); - TestUtils.Simulate.change(ReactDOM.findDOMNode(input), { + const input = form.find('input'); + input.simulate('change', { target: { value: 'bar' }, }); - expect(form.isChanged()).toEqual(true); + expect(form.instance().isChanged()).toEqual(true); expect(hasOnChanged.calledWith({ one: 'bar' })).toEqual(true); }); it('returns false if changes are undone', () => { const hasOnChanged = sinon.spy(); - const form = TestUtils.renderIntoDocument( + const form = mount( , ); - const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input'); - TestUtils.Simulate.change(ReactDOM.findDOMNode(input), { + const input = form.find('input'); + input.simulate('change', { target: { value: 'bar' }, }); expect(hasOnChanged.calledWith({ one: 'bar' })).toBe(true); - TestUtils.Simulate.change(ReactDOM.findDOMNode(input), { + input.simulate('change', { target: { value: 'foo' }, }); - expect(form.isChanged()).toEqual(false); + expect(form.instance().isChanged()).toEqual(false); expect(hasOnChanged.calledWith({ one: 'foo' })).toBe(true); }); }); @@ -703,22 +672,18 @@ describe('form valid state', () => { }; render() { return ( - + ); } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); // Wait for update immediate(() => { expect(form.state.isValid).toEqual(true); - TestUtils.Simulate.submit(ReactDOM.findDOMNode(form)); + form.simulate('submit'); // Wait for update immediate(() => { @@ -731,11 +696,7 @@ describe('form valid state', () => { class TestForm extends React.Component { state = { validationErrors: {}, isValid: true }; setValidationErrors = empty => { - this.setState( - !empty - ? { validationErrors: { foo: 'bar' } } - : { validationErrors: {} }, - ); + this.setState(!empty ? { validationErrors: { foo: 'bar' } } : { validationErrors: {} }); }; onValid = () => { this.setState({ isValid: true }); @@ -745,17 +706,13 @@ describe('form valid state', () => { }; render() { return ( - + ); } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); // Wait for update immediate(() => { @@ -773,11 +730,7 @@ describe('form valid state', () => { class TestForm extends React.Component { state = { validationErrors: {}, isValid: true }; setValidationErrors = empty => { - this.setState( - !empty - ? { validationErrors: { foo: 'bar' } } - : { validationErrors: {} }, - ); + this.setState(!empty ? { validationErrors: { foo: 'bar' } } : { validationErrors: {} }); }; onValid = () => { this.setState({ isValid: true }); @@ -798,7 +751,7 @@ describe('form valid state', () => { ); } } - const form = TestUtils.renderIntoDocument(); + const form = mount(); // Wait for update immediate(() => { diff --git a/__tests__/Rules-equals-spec.js b/__tests__/Rules-equals-spec.js index d1fe3aac..40444d59 100644 --- a/__tests__/Rules-equals-spec.js +++ b/__tests__/Rules-equals-spec.js @@ -1,9 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; -import immediate from '../__test_utils__/immediate'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render: function() { @@ -15,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -27,58 +22,38 @@ class TestForm extends React.Component { describe('equals', () => { it('should pass when the value is equal', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail when the value is not equal', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/__tests__/Rules-isAlpha-spec.js b/__tests__/Rules-isAlpha-spec.js index d91363da..e09b3710 100644 --- a/__tests__/Rules-isAlpha-spec.js +++ b/__tests__/Rules-isAlpha-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render: function() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,71 +22,44 @@ class TestForm extends React.Component { describe('isAlpha', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a string is only latin letters', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a string with numbers', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/__tests__/Rules-isAlphanumeric-spec.js b/__tests__/Rules-isAlphanumeric-spec.js index 827a1205..b6d0a82e 100644 --- a/__tests__/Rules-isAlphanumeric-spec.js +++ b/__tests__/Rules-isAlphanumeric-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,81 +22,51 @@ class TestForm extends React.Component { describe('isAlphanumeric', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a string is only latin letters', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a string with numbers', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a non alpha and number symbols', () => { const value = '!@#$%^&*()'; - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/__tests__/Rules-isEmail-spec.js b/__tests__/Rules-isEmail-spec.js index 479794c1..3dfc0f17 100644 --- a/__tests__/Rules-isEmail-spec.js +++ b/__tests__/Rules-isEmail-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,80 +22,50 @@ class TestForm extends React.Component { describe('isEmail', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with "foo"', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with "foo@foo.com"', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with new long domains', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/__tests__/Rules-isEmptyString-spec.js b/__tests__/Rules-isEmptyString-spec.js index fca3f07e..8a146ad3 100644 --- a/__tests__/Rules-isEmptyString-spec.js +++ b/__tests__/Rules-isEmptyString-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,67 +22,44 @@ class TestForm extends React.Component { describe('isEmptyString', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should fail with non-empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should fail with null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should fail with a zero', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/__tests__/Rules-isExisty-spec.js b/__tests__/Rules-isExisty-spec.js index fb79ab4d..f4ea8163 100644 --- a/__tests__/Rules-isExisty-spec.js +++ b/__tests__/Rules-isExisty-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,67 +22,44 @@ class TestForm extends React.Component { describe('isExisty', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with a string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should fail with null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a zero', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); }); diff --git a/__tests__/Rules-isFloat-spec.js b/__tests__/Rules-isFloat-spec.js index 4d10923d..bb4afe6e 100644 --- a/__tests__/Rules-isFloat-spec.js +++ b/__tests__/Rules-isFloat-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,107 +22,68 @@ class TestForm extends React.Component { describe('isFloat', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with a number as string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail string with digits', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an int', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a float', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a float in science notation', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a zero', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); }); diff --git a/__tests__/Rules-isInt-spec.js b/__tests__/Rules-isInt-spec.js index 9fe9b0f6..d696ca48 100644 --- a/__tests__/Rules-isInt-spec.js +++ b/__tests__/Rules-isInt-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,107 +22,68 @@ class TestForm extends React.Component { describe('isInt', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with a number as string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail string with digits', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an int', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a float', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should fail with a float in science notation', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a zero', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); }); diff --git a/__tests__/Rules-isLength-spec.js b/__tests__/Rules-isLength-spec.js index ebd20e8e..8628e781 100644 --- a/__tests__/Rules-isLength-spec.js +++ b/__tests__/Rules-isLength-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,176 +22,100 @@ class TestForm extends React.Component { describe('isLength:3', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a string too small', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should fail with a string too long', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with matching length', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with null', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with empty string', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); describe('isLength:0', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a string too small', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should fail with a string too long', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with matching length', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with null', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with empty string', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/__tests__/Rules-isNumeric-spec.js b/__tests__/Rules-isNumeric-spec.js index fc6a0cb5..799960dc 100644 --- a/__tests__/Rules-isNumeric-spec.js +++ b/__tests__/Rules-isNumeric-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,107 +22,68 @@ class TestForm extends React.Component { describe('isNumeric', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with an unempty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with a number as string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number as string with not digits', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an int', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a float', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a float in science notation', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a zero', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); }); diff --git a/__tests__/Rules-isUrl-spec.js b/__tests__/Rules-isUrl-spec.js index deb03941..f997cb0f 100644 --- a/__tests__/Rules-isUrl-spec.js +++ b/__tests__/Rules-isUrl-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,69 +22,44 @@ class TestForm extends React.Component { describe('isUrl', () => { it('should pass with default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with "foo"', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with "https://www.google.com/"', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); }); diff --git a/__tests__/Rules-isWords-spec.js b/__tests__/Rules-isWords-spec.js index 3a49789f..edb01032 100644 --- a/__tests__/Rules-isWords-spec.js +++ b/__tests__/Rules-isWords-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,69 +22,44 @@ class TestForm extends React.Component { describe('isWord', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a 1 word', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with 2 words', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a string with numbers', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/__tests__/Rules-maxLength-spec.js b/__tests__/Rules-maxLength-spec.js index 60468a33..c9d4972c 100644 --- a/__tests__/Rules-maxLength-spec.js +++ b/__tests__/Rules-maxLength-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,76 +22,50 @@ class TestForm extends React.Component { describe('maxLength', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it("should pass when a string's length is smaller", () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it("should pass when a string's length is equal", () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it("should fail when a string's length is bigger", () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with empty string', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/__tests__/Rules-minLength-spec.js b/__tests__/Rules-minLength-spec.js index c87b9248..2f1013e2 100644 --- a/__tests__/Rules-minLength-spec.js +++ b/__tests__/Rules-minLength-spec.js @@ -1,8 +1,8 @@ import React from 'react'; -import TestUtils from 'react-dom/test-utils'; import Formsy from './..'; import { InputFactory } from '../__test_utils__/TestInput'; +import { mount } from 'enzyme'; const TestInput = InputFactory({ render() { @@ -14,11 +14,7 @@ class TestForm extends React.Component { render() { return ( - + ); } @@ -26,143 +22,82 @@ class TestForm extends React.Component { describe('minLength:3', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it("should pass when a string's length is bigger", () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it("should fail when a string's length is smaller", () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); it('should pass with empty string', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); describe('minLength:0', () => { it('should pass with a default value', () => { - const form = TestUtils.renderIntoDocument(); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it("should pass when a string's length is bigger", () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with empty string', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with an undefined', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should pass with a null', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(true); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(true); }); it('should fail with a number', () => { - const form = TestUtils.renderIntoDocument( - , - ); - const inputComponent = TestUtils.findRenderedComponentWithType( - form, - TestInput, - ); - expect(inputComponent.isValid()).toEqual(false); + const form = mount(); + const inputComponent = form.find(TestInput); + expect(inputComponent.instance().isValid()).toEqual(false); }); }); diff --git a/lib/Wrapper.js b/lib/Wrapper.js index 55eb10d2..dd7b4fa3 100644 --- a/lib/Wrapper.js +++ b/lib/Wrapper.js @@ -22,10 +22,7 @@ function _typeof(obj) { }; } else { _typeof = function _typeof(obj) { - return obj && - typeof Symbol === 'function' && - obj.constructor === Symbol && - obj !== Symbol.prototype + return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; }; @@ -53,12 +50,7 @@ function _objectSpread(target) { function _defineProperty(obj, key, value) { if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true, - }); + Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } @@ -105,9 +97,7 @@ function _getPrototypeOf(o) { function _assertThisInitialized(self) { if (self === void 0) { - throw new ReferenceError( - "this hasn't been initialised - super() hasn't been called", - ); + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } @@ -133,38 +123,29 @@ function _setPrototypeOf(o, p) { } /* eslint-disable react/default-props-match-prop-types */ -var convertValidationsToObject = function convertValidationsToObject( - validations, -) { +var convertValidationsToObject = function convertValidationsToObject(validations) { if (typeof validations === 'string') { - return validations - .split(/,(?![^{[]*[}\]])/g) - .reduce(function(validationsAccumulator, validation) { - var args = validation.split(':'); - var validateMethod = args.shift(); - args = args.map(function(arg) { - try { - return JSON.parse(arg); - } catch (e) { - return arg; // It is a string if it can not parse it - } - }); - - if (args.length > 1) { - throw new Error( - 'Formsy does not support multiple args on string validations. Use object format of validations instead.', - ); - } // Avoid parameter reassignment - - var validationsAccumulatorCopy = Object.assign( - {}, - validationsAccumulator, + return validations.split(/,(?![^{[]*[}\]])/g).reduce(function(validationsAccumulator, validation) { + var args = validation.split(':'); + var validateMethod = args.shift(); + args = args.map(function(arg) { + try { + return JSON.parse(arg); + } catch (e) { + return arg; // It is a string if it can not parse it + } + }); + + if (args.length > 1) { + throw new Error( + 'Formsy does not support multiple args on string validations. Use object format of validations instead.', ); - validationsAccumulatorCopy[validateMethod] = args.length - ? args[0] - : true; - return validationsAccumulatorCopy; - }, {}); + } // Avoid parameter reassignment + + var validationsAccumulatorCopy = Object.assign({}, validationsAccumulator); + validationsAccumulatorCopy[validateMethod] = args.length ? args[0] : true; + return validationsAccumulatorCopy; + }, {}); } return validations || {}; @@ -178,10 +159,7 @@ var propTypes = { _propTypes['default'].object, _propTypes['default'].string, ]), - validations: _propTypes['default'].oneOfType([ - _propTypes['default'].object, - _propTypes['default'].string, - ]), + validations: _propTypes['default'].oneOfType([_propTypes['default'].object, _propTypes['default'].string]), value: _propTypes['default'].any, // eslint-disable-line react/forbid-prop-types }; exports.propTypes = propTypes; @@ -197,10 +175,7 @@ var _default = function _default(Component) { _classCallCheck(this, WrappedComponent); - _this = _possibleConstructorReturn( - this, - _getPrototypeOf(WrappedComponent).call(this, props), - ); + _this = _possibleConstructorReturn(this, _getPrototypeOf(WrappedComponent).call(this, props)); _this.getErrorMessage = function() { var messages = _this.getErrorMessages(); @@ -210,9 +185,7 @@ var _default = function _default(Component) { _this.getErrorMessages = function() { if (!_this.isValid() || _this.showRequired()) { - return ( - _this.state.externalError || _this.state.validationError || [] - ); + return _this.state.externalError || _this.state.validationError || []; } return []; @@ -234,10 +207,7 @@ var _default = function _default(Component) { }; _this.setValue = function(value) { - var validate = - arguments.length > 1 && arguments[1] !== undefined - ? arguments[1] - : true; + var validate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; if (!validate) { _this.setState({ @@ -281,11 +251,7 @@ var _default = function _default(Component) { }; _this.isValidValue = function(value) { - return _this.context.formsy.isValidValue.call( - null, - _assertThisInitialized(_this), - value, - ); + return _this.context.formsy.isValidValue.call(null, _assertThisInitialized(_this), value); }; _this.resetValue = function() { @@ -328,10 +294,7 @@ var _default = function _default(Component) { var _this2 = this; var configure = function configure() { - _this2.setValidations( - _this2.props.validations, - _this2.props.required, - ); // Pass a function instead? + _this2.setValidations(_this2.props.validations, _this2.props.required); // Pass a function instead? _this2.context.formsy.attachToForm(_this2); }; @@ -373,10 +336,7 @@ var _default = function _default(Component) { } // If validations or required is changed, run a new validation if ( - !_utils['default'].isSame( - this.props.validations, - prevProps.validations, - ) || + !_utils['default'].isSame(this.props.validations, prevProps.validations) || !_utils['default'].isSame(this.props.required, prevProps.required) ) { this.context.formsy.validate(this); @@ -425,17 +385,10 @@ var _default = function _default(Component) { })(_react['default'].Component); function getDisplayName(component) { - return ( - component.displayName || - component.name || - (typeof component === 'string' ? component : 'Component') - ); + return component.displayName || component.name || (typeof component === 'string' ? component : 'Component'); } - WrappedComponent.displayName = 'Formsy('.concat( - getDisplayName(Component), - ')', - ); + WrappedComponent.displayName = 'Formsy('.concat(getDisplayName(Component), ')'); WrappedComponent.contextTypes = { formsy: _propTypes['default'].object, // What about required? }; diff --git a/lib/index.js b/lib/index.js index 2275c45c..23d5dbc4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -44,9 +44,7 @@ function _interopRequireWildcard(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = - Object.defineProperty && Object.getOwnPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : {}; + Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { @@ -84,12 +82,7 @@ function _objectSpread(target) { function _defineProperty(obj, key, value) { if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true, - }); + Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } @@ -132,10 +125,7 @@ function _typeof(obj) { }; } else { _typeof = function _typeof(obj) { - return obj && - typeof Symbol === 'function' && - obj.constructor === Symbol && - obj !== Symbol.prototype + return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; }; @@ -158,9 +148,7 @@ function _possibleConstructorReturn(self, call) { function _assertThisInitialized(self) { if (self === void 0) { - throw new ReferenceError( - "this hasn't been initialised - super() hasn't been called", - ); + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } @@ -205,10 +193,7 @@ var Formsy = _classCallCheck(this, Formsy); - _this = _possibleConstructorReturn( - this, - _getPrototypeOf(Formsy).call(this, props), - ); + _this = _possibleConstructorReturn(this, _getPrototypeOf(Formsy).call(this, props)); _this.getChildContext = function() { return { @@ -249,19 +234,14 @@ var Formsy = return component.props.name; }); - if ( - _utils['default'].arraysDiffer(_this.prevInputNames, newInputNames) - ) { + if (_utils['default'].arraysDiffer(_this.prevInputNames, newInputNames)) { _this.validateForm(); } }; _this.getCurrentValues = function() { return _this.inputs.reduce(function(data, component) { - var dataCopy = - _typeof(component.state.value) === 'object' - ? Object.assign({}, data) - : data; // avoid param reassignment + var dataCopy = _typeof(component.state.value) === 'object' ? Object.assign({}, data) : data; // avoid param reassignment dataCopy[component.props.name] = component.state.value; return dataCopy; @@ -277,10 +257,7 @@ var Formsy = _this.getPristineValues = function() { return _this.inputs.reduce(function(data, component) { var name = component.props.name; - var dataCopy = - _typeof(component.state.value) === 'object' - ? Object.assign({}, data) - : data; // avoid param reassignment + var dataCopy = _typeof(component.state.value) === 'object' ? Object.assign({}, data) : data; // avoid param reassignment dataCopy[name] = component.props.value; return dataCopy; @@ -307,10 +284,7 @@ var Formsy = var args = [ { isValid: !(name in errors), - validationError: - typeof errors[name] === 'string' - ? [errors[name]] - : errors[name], + validationError: typeof errors[name] === 'string' ? [errors[name]] : errors[name], }, ]; component.setState.apply(component, args); @@ -349,9 +323,7 @@ var Formsy = while (keyArray.length) { var currentKey = keyArray.shift(); - base[currentKey] = keyArray.length - ? base[currentKey] || {} - : model[key]; + base[currentKey] = keyArray.length ? base[currentKey] || {} : model[key]; base = base[currentKey]; } @@ -391,10 +363,7 @@ var Formsy = }; _this.runValidation = function(component) { - var value = - arguments.length > 1 && arguments[1] !== undefined - ? arguments[1] - : component.state.value; + var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : component.state.value; var currentValues = _this.getCurrentValues(); @@ -416,15 +385,10 @@ var Formsy = _validationRules['default'], ); - var isRequired = Object.keys(component.requiredValidations).length - ? !!requiredResults.success.length - : false; + var isRequired = Object.keys(component.requiredValidations).length ? !!requiredResults.success.length : false; var isValid = !validationResults.failed.length && - !( - _this.props.validationErrors && - _this.props.validationErrors[component.props.name] - ); + !(_this.props.validationErrors && _this.props.validationErrors[component.props.name]); return { isRequired: isRequired, isValid: isRequired ? false : isValid, @@ -437,29 +401,21 @@ var Formsy = return validationResults.errors; } - if ( - _this.props.validationErrors && - _this.props.validationErrors[component.props.name] - ) { - return typeof _this.props.validationErrors[ - component.props.name - ] === 'string' + if (_this.props.validationErrors && _this.props.validationErrors[component.props.name]) { + return typeof _this.props.validationErrors[component.props.name] === 'string' ? [_this.props.validationErrors[component.props.name]] : _this.props.validationErrors[component.props.name]; } if (isRequired) { - var error = - validationErrors[requiredResults.success[0]] || validationError; + var error = validationErrors[requiredResults.success[0]] || validationError; return error ? [error] : null; } if (validationResults.failed.length) { return validationResults.failed .map(function(failed) { - return validationErrors[failed] - ? validationErrors[failed] - : validationError; + return validationErrors[failed] ? validationErrors[failed] : validationError; }) .filter(function(x, pos, arr) { return arr.indexOf(x) === pos; @@ -483,19 +439,14 @@ var Formsy = var componentPos = _this.inputs.indexOf(component); if (componentPos !== -1) { - _this.inputs = _this.inputs - .slice(0, componentPos) - .concat(_this.inputs.slice(componentPos + 1)); + _this.inputs = _this.inputs.slice(0, componentPos).concat(_this.inputs.slice(componentPos + 1)); } _this.validateForm(); }; _this.isChanged = function() { - return !_utils['default'].isSame( - _this.getPristineValues(), - _this.getCurrentValues(), - ); + return !_utils['default'].isSame(_this.getPristineValues(), _this.getCurrentValues()); }; _this.submit = function(event) { @@ -509,24 +460,12 @@ var Formsy = var model = _this.getModel(); - _this.props.onSubmit( - model, - _this.resetModel, - _this.updateInputsWithError, - ); + _this.props.onSubmit(model, _this.resetModel, _this.updateInputsWithError); if (_this.state.isValid) { - _this.props.onValidSubmit( - model, - _this.resetModel, - _this.updateInputsWithError, - ); + _this.props.onValidSubmit(model, _this.resetModel, _this.updateInputsWithError); } else { - _this.props.onInvalidSubmit( - model, - _this.resetModel, - _this.updateInputsWithError, - ); + _this.props.onInvalidSubmit(model, _this.resetModel, _this.updateInputsWithError); } }; @@ -547,10 +486,7 @@ var Formsy = var args = [ { isValid: _this.props.preventExternalInvalidation, - externalError: - typeof errors[name] === 'string' - ? [errors[name]] - : errors[name], + externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name], }, ]; component.setState.apply(component, args); @@ -610,9 +546,7 @@ var Formsy = isRequired: validation.isRequired, validationError: validation.error, externalError: - !validation.isValid && component.state.externalError - ? component.state.externalError - : null, + !validation.isValid && component.state.externalError ? component.state.externalError : null, }, index === _this.inputs.length - 1 ? onValidationComplete : null, ); diff --git a/lib/utils.js b/lib/utils.js index 0707d5e3..34bf58c2 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -12,10 +12,7 @@ function _typeof(obj) { }; } else { _typeof = function _typeof(obj) { - return obj && - typeof Symbol === 'function' && - obj.constructor === Symbol && - obj !== Symbol.prototype + return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; }; @@ -65,12 +62,7 @@ var _default = { return !this.arraysDiffer(a, b); } else if (typeof a === 'function') { return a.toString() === b.toString(); - } else if ( - a !== null && - b !== null && - a instanceof Date && - b instanceof Date - ) { + } else if (a !== null && b !== null && a instanceof Date && b instanceof Date) { return a.toString() === b.toString(); } else if (_typeof(a) === 'object' && a !== null && b !== null) { return !this.objectsDiffer(a, b); @@ -89,12 +81,7 @@ var _default = { return null; }, - runRules: function runRules( - value, - currentValues, - validations, - validationRules, - ) { + runRules: function runRules(value, currentValues, validations, validationRules) { var results = { errors: [], failed: [], @@ -103,26 +90,12 @@ var _default = { if (Object.keys(validations).length) { Object.keys(validations).forEach(function(validationMethod) { - if ( - validationRules[validationMethod] && - typeof validations[validationMethod] === 'function' - ) { - throw new Error( - 'Formsy does not allow you to override default validations: '.concat( - validationMethod, - ), - ); + if (validationRules[validationMethod] && typeof validations[validationMethod] === 'function') { + throw new Error('Formsy does not allow you to override default validations: '.concat(validationMethod)); } - if ( - !validationRules[validationMethod] && - typeof validations[validationMethod] !== 'function' - ) { - throw new Error( - 'Formsy does not have the validation rule: '.concat( - validationMethod, - ), - ); + if (!validationRules[validationMethod] && typeof validations[validationMethod] !== 'function') { + throw new Error('Formsy does not have the validation rule: '.concat(validationMethod)); } if (typeof validations[validationMethod] === 'function') { @@ -137,11 +110,7 @@ var _default = { return; } else if (typeof validations[validationMethod] !== 'function') { - var _validation = validationRules[validationMethod]( - currentValues, - value, - validations[validationMethod], - ); + var _validation = validationRules[validationMethod](currentValues, value, validations[validationMethod]); if (typeof _validation === 'string') { results.errors.push(_validation); diff --git a/lib/validationRules.js b/lib/validationRules.js index d9131a13..d004d2ee 100644 --- a/lib/validationRules.js +++ b/lib/validationRules.js @@ -38,11 +38,7 @@ var validations = { ); }, isUrl: function isUrl(values, value) { - return validations.matchRegexp( - values, - value, - /^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/i, - ); + return validations.matchRegexp(values, value, /^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/i); }, isTrue: function isTrue(values, value) { return value === true; @@ -67,11 +63,7 @@ var validations = { return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\d*))$/); }, isFloat: function isFloat(values, value) { - return validations.matchRegexp( - values, - value, - /^(?:[-+]?(?:\d+))?(?:\.\d*)?(?:[eE][+-]?(?:\d+))?$/, - ); + return validations.matchRegexp(values, value, /^(?:[-+]?(?:\d+))?(?:\.\d*)?(?:[eE][+-]?(?:\d+))?$/); }, isWords: function isWords(values, value) { return validations.matchRegexp(values, value, /^[A-Z\s]+$/i); diff --git a/package.json b/package.json index da6f8d8d..7b48f168 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,14 @@ "pre-commit": "pretty-quick --staged" } }, + "jest": { + "transform": { + "^.+\\.(js|jsx|ts|tsx)$": "babel-jest" + }, + "setupFilesAfterEnv": [ + "./setupTests.js" + ] + }, "license": "MIT", "homepage": "https://github.com/formsy/formsy-react", "bugs": "https://github.com/formsy/formsy-react/issues", @@ -36,26 +44,29 @@ "build": "NODE_ENV=production webpack -p --config webpack.config.js && yarn run prepublish", "changelog": "standard-changelog", "deploy": "np --any-branch", - "format": "prettier --write src/**/* tests/**/* tests/*", + "format": "prettier --write src/**/* __tests__/**/* __tests__/* __test_utils__/**/* __test_utils__/*", "lint": "eslint src/**/*.js", "prepublish": "rm -Rf ./lib && babel ./src/ -d ./lib/", "test": "jest", "version": "npm run build && git add lib && git add release && npm run changelog && git add CHANGELOG.md" }, "dependencies": { - "@babel/node": "^7.4.5", "form-data-to-object": "^0.2.0", - "prop-types": "^15.5.10" + "prop-types": "^15.5.10", + "react-dom": "^16.8.6" }, "devDependencies": { "@babel/cli": "^7.4.4", "@babel/core": "^7.4.5", + "@babel/node": "^7.4.5", "@babel/plugin-proposal-class-properties": "^7.4.4", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.0.0", "babel-eslint": "^10.0.2", "babel-jest": "^24.8.0", "babel-loader": "^8.0.6", + "enzyme": "^3.10.0", + "enzyme-adapter-react-16": "^1.14.0", "eslint": "^4.14.0", "eslint-config-airbnb": "^16.1.0", "eslint-config-prettier": "^5.0.0", @@ -72,13 +83,11 @@ "react": "^16.2.0 || ^16.0.0", "react-addons-pure-render-mixin": "^15.6.0", "react-addons-test-utils": "^15.6.0", - "react-dom": "^16.2.0 || ^16.0.0", "sinon": "^7.3.2", "standard-changelog": "^2.0.11", "webpack": "^3.10.0" }, "peerDependencies": { - "react": "^15.6.1 || ^16.0.0", - "react-dom": "^15.6.1 || ^16.0.0" + "react": "^15.6.1 || ^16.0.0" } } diff --git a/setupTests.js b/setupTests.js new file mode 100644 index 00000000..32a0790c --- /dev/null +++ b/setupTests.js @@ -0,0 +1,4 @@ +import enzyme from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; + +enzyme.configure({ adapter: new Adapter() }); diff --git a/webpack.config.js b/webpack.config.js index 790d88db..8a11b5c1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,13 +11,6 @@ module.exports = { amd: 'react', umd: 'react', }, - 'react-dom': { - root: 'ReactDOM', - commonjs2: 'react-dom', - commonjs: 'react-dom', - amd: 'react-dom', - umd: 'react-dom', - }, }, output: { path: path.resolve(__dirname, 'release'), @@ -26,10 +19,12 @@ module.exports = { library: 'Formsy', }, module: { - loaders: [{ - test: /\.jsx?$/, - exclude: /node_modules/, - loader: 'babel-loader', - }], + loaders: [ + { + test: /\.jsx?$/, + exclude: /node_modules/, + loader: 'babel-loader', + }, + ], }, }; diff --git a/yarn.lock b/yarn.lock index c533e61f..e21a6d87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1093,6 +1093,22 @@ add-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" +airbnb-prop-types@^2.13.2: + version "2.13.2" + resolved "https://registry.yarnpkg.com/airbnb-prop-types/-/airbnb-prop-types-2.13.2.tgz#43147a5062dd2a4a5600e748a47b64004cc5f7fc" + integrity sha512-2FN6DlHr6JCSxPPi25EnqGaXC4OC3/B3k1lCd6MMYrZ51/Gf/1qDfaR+JElzWa+Tl7cY2aYOlsYJGFeQyVHIeQ== + dependencies: + array.prototype.find "^2.0.4" + function.prototype.name "^1.1.0" + has "^1.0.3" + is-regex "^1.0.4" + object-is "^1.0.1" + object.assign "^4.1.0" + object.entries "^1.1.0" + prop-types "^15.7.2" + prop-types-exact "^1.2.0" + react-is "^16.8.6" + ajv-keywords@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" @@ -1266,6 +1282,11 @@ array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" +array-filter@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83" + integrity sha1-uveeYubvTCpMC4MSMtr/7CUfnYM= + array-find-index@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" @@ -1310,6 +1331,23 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= +array.prototype.find@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.1.0.tgz#630f2eaf70a39e608ac3573e45cf8ccd0ede9ad7" + integrity sha512-Wn41+K1yuO5p7wRZDl7890c3xvv5UBrfVXTVIe28rSQb6LS0fZMDrQB6PAcxQFRFy6vJTLDc3A2+3CjQdzVKRg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.13.0" + +array.prototype.flat@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.1.tgz#812db8f02cad24d3fab65dd67eabe3b8903494a4" + integrity sha512-rVqIs330nLJvfC7JqYvEWwqVr5QjYF1ib02i3YJtR/fICO6527Tjpc/e4Mvmxh3GIePPreRXMdaGyC99YphWEw== + dependencies: + define-properties "^1.1.2" + es-abstract "^1.10.0" + function-bind "^1.1.1" + arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -1518,6 +1556,11 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" +boolbase@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" + integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= + boom@4.x.x: version "4.3.1" resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" @@ -1854,6 +1897,18 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== +cheerio@^1.0.0-rc.2: + version "1.0.0-rc.3" + resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.3.tgz#094636d425b2e9c0f4eb91a46c05630c9a1a8bf6" + integrity sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA== + dependencies: + css-select "~1.2.0" + dom-serializer "~0.1.1" + entities "~1.1.1" + htmlparser2 "^3.9.1" + lodash "^4.15.0" + parse5 "^3.0.1" + chokidar@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" @@ -2036,7 +2091,7 @@ commander@^2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" -commander@^2.8.1, commander@~2.20.0: +commander@^2.19.0, commander@^2.8.1, commander@~2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== @@ -2334,6 +2389,21 @@ crypto-random-string@^1.0.0: resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" integrity sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4= +css-select@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" + integrity sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg= + dependencies: + boolbase "~1.0.0" + css-what "2.1" + domutils "1.5.1" + nth-check "~1.0.1" + +css-what@2.1: + version "2.1.3" + resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2" + integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg== + cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.2" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" @@ -2455,7 +2525,7 @@ defer-to-connect@^1.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.0.2.tgz#4bae758a314b034ae33902b5aac25a8dd6a8633e" integrity sha512-k09hcQcTDY+cwgiwa6PYKLm3jlagNzQ+RSvhjzESOGOx+MNOuXkxTfEvPrO1IOQ81tArCFYQgi631clB70RpQw== -define-properties@^1.1.2: +define-properties@^1.1.2, define-properties@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== @@ -2563,6 +2633,11 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +discontinuous-range@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/discontinuous-range/-/discontinuous-range-1.0.0.tgz#e38331f0844bba49b9a9cb71c771585aab1bc65a" + integrity sha1-44Mx8IRLukm5qctxx3FYWqsbxlo= + doctrine@1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" @@ -2577,6 +2652,14 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +dom-serializer@0, dom-serializer@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0" + integrity sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA== + dependencies: + domelementtype "^1.3.0" + entities "^1.1.1" + domain-browser@^1.1.1: version "1.1.7" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" @@ -2586,10 +2669,38 @@ domain-browser@^1.2.0: resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== +domelementtype@1, domelementtype@^1.3.0, domelementtype@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" + integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w== + domexception@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.0.tgz#81fe5df81b3f057052cde3a9fa9bf536a85b9ab0" +domhandler@^2.3.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803" + integrity sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA== + dependencies: + domelementtype "1" + +domutils@1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" + integrity sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8= + dependencies: + dom-serializer "0" + domelementtype "1" + +domutils@^1.5.1: + version "1.7.0" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a" + integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg== + dependencies: + dom-serializer "0" + domelementtype "1" + dot-prop@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-3.0.0.tgz#1b708af094a49c9a0e7dbcad790aba539dac1177" @@ -2673,6 +2784,64 @@ enhanced-resolve@^3.4.0: object-assign "^4.0.1" tapable "^0.2.7" +entities@^1.1.1, entities@~1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" + integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== + +enzyme-adapter-react-16@^1.14.0: + version "1.14.0" + resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.14.0.tgz#204722b769172bcf096cb250d33e6795c1f1858f" + integrity sha512-7PcOF7pb4hJUvjY7oAuPGpq3BmlCig3kxXGi2kFx0YzJHppqX1K8IIV9skT1IirxXlu8W7bneKi+oQ10QRnhcA== + dependencies: + enzyme-adapter-utils "^1.12.0" + has "^1.0.3" + object.assign "^4.1.0" + object.values "^1.1.0" + prop-types "^15.7.2" + react-is "^16.8.6" + react-test-renderer "^16.0.0-0" + semver "^5.7.0" + +enzyme-adapter-utils@^1.12.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.12.0.tgz#96e3730d76b872f593e54ce1c51fa3a451422d93" + integrity sha512-wkZvE0VxcFx/8ZsBw0iAbk3gR1d9hK447ebnSYBf95+r32ezBq+XDSAvRErkc4LZosgH8J7et7H7/7CtUuQfBA== + dependencies: + airbnb-prop-types "^2.13.2" + function.prototype.name "^1.1.0" + object.assign "^4.1.0" + object.fromentries "^2.0.0" + prop-types "^15.7.2" + semver "^5.6.0" + +enzyme@^3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.10.0.tgz#7218e347c4a7746e133f8e964aada4a3523452f6" + integrity sha512-p2yy9Y7t/PFbPoTvrWde7JIYB2ZyGC+NgTNbVEGvZ5/EyoYSr9aG/2rSbVvyNvMHEhw9/dmGUJHWtfQIEiX9pg== + dependencies: + array.prototype.flat "^1.2.1" + cheerio "^1.0.0-rc.2" + function.prototype.name "^1.1.0" + has "^1.0.3" + html-element-map "^1.0.0" + is-boolean-object "^1.0.0" + is-callable "^1.1.4" + is-number-object "^1.0.3" + is-regex "^1.0.4" + is-string "^1.0.4" + is-subset "^0.1.1" + lodash.escape "^4.0.1" + lodash.isequal "^4.5.0" + object-inspect "^1.6.0" + object-is "^1.0.1" + object.assign "^4.1.0" + object.entries "^1.0.4" + object.values "^1.0.4" + raf "^3.4.0" + rst-selector-parser "^2.2.3" + string.prototype.trim "^1.1.2" + errno@^0.1.3: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" @@ -2687,7 +2856,7 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.11.0, es-abstract@^1.5.1, es-abstract@^1.7.0: +es-abstract@^1.10.0, es-abstract@^1.11.0, es-abstract@^1.12.0, es-abstract@^1.13.0, es-abstract@^1.5.0, es-abstract@^1.5.1, es-abstract@^1.7.0: version "1.13.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== @@ -3367,7 +3536,7 @@ fsevents@^1.0.0, fsevents@^1.2.7: nan "^2.12.1" node-pre-gyp "^0.12.0" -function-bind@^1.1.1: +function-bind@^1.0.2, function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== @@ -3376,6 +3545,15 @@ function-loop@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/function-loop/-/function-loop-1.0.1.tgz#8076bb305e8e6a3cceee2920765f330d190f340c" +function.prototype.name@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.0.tgz#8bd763cc0af860a859cc5d49384d74b932cd2327" + integrity sha512-Bs0VRrTz4ghD8pTmbJQD1mZ8A/mN0ur/jGz+A6FBxPDUPkm1tNfF6bhTYPA7i7aF4lZJVr+OXTNNrnnIl58Wfg== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + is-callable "^1.1.3" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" @@ -3771,12 +3949,31 @@ hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== +html-element-map@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/html-element-map/-/html-element-map-1.0.1.tgz#3c4fcb4874ebddfe4283b51c8994e7713782b592" + integrity sha512-BZSfdEm6n706/lBfXKWa4frZRZcT5k1cOusw95ijZsHlI+GdgY0v95h6IzO3iIDf2ROwq570YTwqNPqHcNMozw== + dependencies: + array-filter "^1.0.0" + html-encoding-sniffer@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" dependencies: whatwg-encoding "^1.0.1" +htmlparser2@^3.9.1: + version "3.10.1" + resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f" + integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ== + dependencies: + domelementtype "^1.3.1" + domhandler "^2.3.0" + domutils "^1.5.1" + entities "^1.1.1" + inherits "^2.0.1" + readable-stream "^3.1.1" + http-cache-semantics@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz#495704773277eeef6e43f9ab2c2c7d259dda25c5" @@ -3995,6 +4192,11 @@ is-binary-path@^1.0.0: dependencies: binary-extensions "^1.0.0" +is-boolean-object@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.0.tgz#98f8b28030684219a95f375cfbd88ce3405dff93" + integrity sha1-mPiygDBoQhmpXzdc+9iM40Bd/5M= + is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -4007,7 +4209,7 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" -is-callable@^1.1.4: +is-callable@^1.1.3, is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== @@ -4160,6 +4362,11 @@ is-npm@^1.0.0: resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" integrity sha1-8vtjpl5JBbQGyGBydloaTceTufQ= +is-number-object@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.3.tgz#f265ab89a9f445034ef6aff15a8f00b00f551799" + integrity sha1-8mWrian0RQNO9q/xWo8AsA9VF5k= + is-number@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" @@ -4295,6 +4502,16 @@ is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" +is-string@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.4.tgz#cc3a9b69857d621e963725a24caeec873b826e64" + integrity sha1-zDqbaYV9Yh6WNyWiTK7shzuCbmQ= + +is-subset@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" + integrity sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY= + is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" @@ -5122,11 +5339,21 @@ lodash._reinterpolate@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" +lodash.escape@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-4.0.1.tgz#c9044690c21e04294beaa517712fded1fa88de98" + integrity sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg= + lodash.flattendeep@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI= +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -5154,7 +5381,7 @@ lodash.zip@^4.2.0: resolved "https://registry.yarnpkg.com/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020" integrity sha1-7GZi5IlkCO1KtsVCo5kLcswIACA= -lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.2.1, lodash@^4.3.0: +lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.2.1, lodash@^4.3.0: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== @@ -5514,6 +5741,11 @@ modify-values@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.0.tgz#e2b6cdeb9ce19f99317a53722f3dbf5df5eaaab2" +moo@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/moo/-/moo-0.4.3.tgz#3f847a26f31cf625a956a87f2b10fbc013bfd10e" + integrity sha512-gFD2xGCl8YFgGHsqJ9NKRVdwlioeW3mI1iqfLNYQOv0+6JRwG58Zk9DIGQgyIaffSYaO1xsKnMaYzzNr1KyIAw== + mri@^1.1.0: version "1.1.4" resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.4.tgz#7cb1dd1b9b40905f1fac053abe25b6720f44744a" @@ -5569,6 +5801,17 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +nearley@^2.7.10: + version "2.16.0" + resolved "https://registry.yarnpkg.com/nearley/-/nearley-2.16.0.tgz#77c297d041941d268290ec84b739d0ee297e83a7" + integrity sha512-Tr9XD3Vt/EujXbZBv6UAHYoLUSMQAxSsTnm9K3koXzjzNWY195NqALeyrzLZBKzAkL3gl92BcSogqrHjD8QuUg== + dependencies: + commander "^2.19.0" + moo "^0.4.3" + railroad-diagrams "^1.0.0" + randexp "0.4.6" + semver "^5.4.1" + needle@^2.2.1: version "2.4.0" resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" @@ -5823,6 +6066,13 @@ npmlog@^4.0.2: gauge "~2.7.3" set-blocking "~2.0.0" +nth-check@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c" + integrity sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg== + dependencies: + boolbase "~1.0.0" + null-check@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/null-check/-/null-check-1.0.0.tgz#977dffd7176012b9ec30d2a39db5cf72a0439edd" @@ -5889,7 +6139,17 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-keys@^1.0.12: +object-inspect@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" + integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== + +object-is@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6" + integrity sha1-CqYOyZiaCz7Xlc9NBvYs8a1lObY= + +object-keys@^1.0.11, object-keys@^1.0.12: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -5901,6 +6161,26 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" +object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.entries@^1.0.4, object.entries@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.0.tgz#2024fc6d6ba246aee38bdb0ffd5cfbcf371b7519" + integrity sha512-l+H6EQ8qzGRxbkHOd5I/aHRhHDKoQXQ8g0BYt4uSweQU1/J6dZUOyWh9a2Vky35YCKjzmgxOzta2hH6kf9HuXA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + object.fromentries@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.0.tgz#49a543d92151f8277b3ac9600f1e930b189d30ab" @@ -5934,6 +6214,16 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" +object.values@^1.0.4, object.values@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.0.tgz#bf6810ef5da3e5325790eaaa2be213ea84624da9" + integrity sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -6211,9 +6501,10 @@ parse-passwd@^1.0.0: resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= -parse5@^3.0.2: +parse5@^3.0.1, parse5@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" + integrity sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA== dependencies: "@types/node" "*" @@ -6459,6 +6750,15 @@ prompts@^2.0.1: kleur "^3.0.2" sisteransi "^1.0.0" +prop-types-exact@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/prop-types-exact/-/prop-types-exact-1.2.0.tgz#825d6be46094663848237e3925a98c6e944e9869" + integrity sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA== + dependencies: + has "^1.0.3" + object.assign "^4.1.0" + reflect.ownkeys "^0.2.0" + prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" @@ -6540,6 +6840,26 @@ quick-lru@^1.0.0: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= +raf@^3.4.0: + version "3.4.1" + resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39" + integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA== + dependencies: + performance-now "^2.1.0" + +railroad-diagrams@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz#eb7e6267548ddedfb899c1b90e57374559cddb7e" + integrity sha1-635iZ1SN3t+4mcG5Dlc3RVnN234= + +randexp@0.4.6: + version "0.4.6" + resolved "https://registry.yarnpkg.com/randexp/-/randexp-0.4.6.tgz#e986ad5e5e31dae13ddd6f7b3019aa7c87f60ca3" + integrity sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ== + dependencies: + discontinuous-range "1.0.0" + ret "~0.1.10" + randomatic@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" @@ -6583,7 +6903,7 @@ react-addons-test-utils@^15.6.0: version "15.6.2" resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.6.2.tgz#c12b6efdc2247c10da7b8770d185080a7b047156" -"react-dom@^16.2.0 || ^16.0.0": +react-dom@^16.8.6: version "16.8.6" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f" integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA== @@ -6593,11 +6913,21 @@ react-addons-test-utils@^15.6.0: prop-types "^15.6.2" scheduler "^0.13.6" -react-is@^16.8.1, react-is@^16.8.4: +react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: version "16.8.6" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== +react-test-renderer@^16.0.0-0: + version "16.8.6" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.8.6.tgz#188d8029b8c39c786f998aa3efd3ffe7642d5ba1" + integrity sha512-H2srzU5IWYT6cZXof6AhUcx/wEyJddQ8l7cLM/F7gDXYyPr4oq+vCIxJYXVGhId1J706sqziAjuOEjyNkfgoEw== + dependencies: + object-assign "^4.1.1" + prop-types "^15.6.2" + react-is "^16.8.6" + scheduler "^0.13.6" + "react@^16.2.0 || ^16.0.0": version "16.8.6" resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe" @@ -6717,6 +7047,15 @@ readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" +readable-stream@^3.1.1: + version "3.4.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" + integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readdirp@^2.0.0, readdirp@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" @@ -6749,6 +7088,11 @@ redent@^2.0.0: indent-string "^3.0.0" strip-indent "^2.0.0" +reflect.ownkeys@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz#749aceec7f3fdf8b63f927a04809e90c5c0b3460" + integrity sha1-dJrO7H8/34tj+SegSAnpDFwLNGA= + regenerate-unicode-properties@^8.0.2: version "8.1.0" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" @@ -7052,6 +7396,14 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^2.0.0" inherits "^2.0.1" +rst-selector-parser@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz#81b230ea2fcc6066c89e3472de794285d9b03d91" + integrity sha1-gbIw6i/MYGbInjRy3nlChdmwPZE= + dependencies: + lodash.flattendeep "^4.4.0" + nearley "^2.7.10" + rsvp@^4.8.4: version "4.8.5" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" @@ -7512,6 +7864,15 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string.prototype.trim@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" + integrity sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.0" + function-bind "^1.0.2" + string_decoder@^0.10.25: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"