Unable to access react modal component jsx when exported with Redux The Next CEO of Stack OverflowReact JSX: Access Props in QuotesLoop inside React JSXcall function after react-router-redux pushCreate modal in react-redux using stateless functional componentsReactjs refresh parent after react modal popup changes dataReact prevent from toggle multiple modalsHow do I test component methods on a React component that are defined as arrow functions (class properties)?(React) How do you pass in functions to components that are wrapped in a variable?Mocking a React component function that is enclosed by Redux Provider componentHow to unit test the output of a React component method in a React Router / Redux app with Enzyme

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

How many extra stops do monopods offer for tele photographs?

Why this way of making earth uninhabitable in Interstellar?

Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?

Is there a difference between "Fahrstuhl" and "Aufzug"

Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?

Can MTA send mail via a relay without being told so?

What happened in Rome, when the western empire "fell"?

What does "Its cash flow is deeply negative" mean?

Solving system of ODEs with extra parameter

Is it okay to majorly distort historical facts while writing a fiction story?

Is wanting to ask what to write an indication that you need to change your story?

Does it make sense to invest money on space investigation?

WOW air has ceased operation, can I get my tickets refunded?

Proper way to express "He disappeared them"

Flying from Cape Town to England and return to another province

Powershell. How to parse gci Name?

Does soap repel water?

Make solar eclipses exceedingly rare, but still have new moons

Newlines in BSD sed vs gsed

What flight has the highest ratio of time difference to flight time?

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Running a General Election and the European Elections together

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?



Unable to access react modal component jsx when exported with Redux



The Next CEO of Stack OverflowReact JSX: Access Props in QuotesLoop inside React JSXcall function after react-router-redux pushCreate modal in react-redux using stateless functional componentsReactjs refresh parent after react modal popup changes dataReact prevent from toggle multiple modalsHow do I test component methods on a React component that are defined as arrow functions (class properties)?(React) How do you pass in functions to components that are wrapped in a variable?Mocking a React component function that is enclosed by Redux Provider componentHow to unit test the output of a React component method in a React Router / Redux app with Enzyme










1















I have a test for a React component which is being exported with connect. I was able to have my tests pass, but my Snapsnot is not what I expect it to be. I opened a GH issue with the enzyme team as well Note I took out some of the methods, since they are not applicable to the issue.



My Component



import React, Component from 'react';
import PropTypes from 'prop-types'
import bindActionCreators from 'redux';
import connect from 'react-redux';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import get from 'lodash/get';
import isArray from 'lodash/isArray';
import isString from '../../helpers/typeCheckHelper';
import classNames from 'classnames';
import * as actionCreators from '../../actions/modal';
import GenericModal from '../GenericModal';
import Notify from '../../components/Notify';
import s from './AnalyzeModal.scss';


export class AnalyzeModal extends Component

static propTypes =
data: PropTypes.object,
sendData: PropTypes.func,
isOpen: PropTypes.bool,
openModal: PropTypes.func,
closeModal: PropTypes.func,
customStyles: PropTypes.object,
wasClicked: PropTypes.bool,
isSpinner: PropTypes.bool,
toggleSpinner: PropTypes.func,
handleAnalyzeListOfBonds: PropTypes.func,
id: PropTypes.string,


constructor(props)
super(props);
this.state =
notes: '',
;
this.closeModal = this.closeModal.bind(this);
this.handleNotesChange = this.handleNotesChange.bind(this);


render()
const isOpen, customStyles, wasClicked, isSpinner, id = this.props;

return (
<GenericModal
isOpen=isOpen
style=customStyles
contentLabel="List/Portfolio Review"
>
<div className=classNames('buy-btn-modal row', s['analyze-modal'])>
<h1 className="column small-11 header">Portfolio Review</h1>
<button
className="column small-1 close-modal"
data-id=`$MODAL-close-button`
onClick=() => this.closeModal();
>X</button>
<div className="column small-12">
<div className=classNames('column small-12', s['table-container'], s['force-show-scrollbar'])>
<div className=classNames('row', s['table-header'])>
<div className=classNames('columns small-3 text-left', s['table-header-label'])>QUANTITY</div>
</div>
this.renderTableData()
</div>
<div className="column small-12 field-container">
<label
className="label column small-3 text-right"
htmlFor="notes"
>NOTES</label>
<textarea
className=classNames('notes-field', s['notes-field'])
data-id=`$MODAL-form-notes`
onChange=this.handleNotesChange
/>
</div>
<div className="column small-12 button-wrapper">
<button
className=classNames('small-4 bright-blue submit-btn', s['submit-btn'])
data-id=`$MODAL-submit-button`
onClick=() => this.handleSubmit();
disabled=!!wasClicked
>
isSpinner ?
<div className="spinner-full-page modal-spinner" /> :
'Submit'

</button>
<button
className=classNames('small-4 bright-blue cancel-btn', s['cancel-btn'])
onClick=() => this.closeModal();
>Cancel</button>
</div>
</div>
</div>
</GenericModal>
);



const mapDispatchToProps = dispatch => (
bindActionCreators(actionCreators, dispatch)
);

const mapStateToProps = state => (
isOpen: state.modal.isModalOpen,
id: state.modal.id,
wasClicked: state.modal.wasClicked,
isSpinner: state.modal.isSpinner,
data: state.modal.data,
);

export default withStyles(s)(connect(mapStateToProps, mapDispatchToProps)(AnalyzeModal));


My Test



import React from 'react';
import AnalyzeModal from '../components/AnalyzeModal';
import Link from '../components/Link';
import render, mount, shallow from 'enzyme';
import thunk from 'redux-thunk';
import configureMockStore from 'redux-mock-store';

describe('<Analyze />', () =>
// create any initial state needed to render Connected component
const initialState =
modal:
isModalOpen: false,
id: '',
wasClicked: false,
isMarkIncluded: false,
isSpinner: false,
isOpen: null,
openModal: null,
closeModal: null,
data: null,
,
;

const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
let wrapper;
let store;

beforeEach(() =>
store = mockStore(initialState);
wrapper = mount(<AnalyzeModal store=store />);
);

test('should be defined', () =>
expect(wrapper).toBeDefined();
);

test('matches the snapshot', () =>
expect(wrapper).toMatchSnapshot();
)
);


My Test Snapshot



// Jest Snapshot v1

exports[`<Analyze /> matches the snapshot 1`] = `
<Connect(AnalyzeModal)
store=
Object
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],


>
<AnalyzeModal
closeModal=[Function]
data=null
id=""
isOpen=false
isSpinner=false
openModal=[Function]
sendData=[Function]
store=
Object
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],


toggleMark=[Function]
toggleSpinner=[Function]
wasClicked=false
/>
</Connect(AnalyzeModal)>


Current behavior
Currently, the snapshot is returning the component without the JSX inside of the component itself.



Expected behavior
I expect the component to container jsx elements such as: button, div, etc.



My environment:



Version



 library | version
enzyme | "^3.9.0"
react | "^15.3.1"
react-dom | "^15.3.1"
react-test-renderer | "^15.3.1"
adapter (enzyme-adapter-react-15.4) | "^1.3.1"











share|improve this question
























  • Does GenericModal not render anything if its isOpen prop is false? (that would be my guess without being able to actually run and test anything)

    – brian-lives-outdoors
    Mar 21 at 22:24











  • It does not, so I tried two things: first, changing my initialState object to have isOpen set to true. second, performing a setProps in my first test case: wrapper.setProps( isOpen: true ). When I console.log(wrapper), it returns: ReactWrapper

    – eagercoder
    Mar 22 at 0:16











  • @brian-lives-outdoors, I think this is a good starting point. Meaning the issue, is likely related to the modal not being open. I may need to use sinon to spy on the openModal method in my reducer, to trigger the opening of the modal, but that seems like overlike. Thoughts?

    – eagercoder
    Mar 22 at 0:18











  • @brian-lives-outdoors, setting isOpen to false, didn't fix it. Any other ideas?

    – eagercoder
    Mar 25 at 19:31















1















I have a test for a React component which is being exported with connect. I was able to have my tests pass, but my Snapsnot is not what I expect it to be. I opened a GH issue with the enzyme team as well Note I took out some of the methods, since they are not applicable to the issue.



My Component



import React, Component from 'react';
import PropTypes from 'prop-types'
import bindActionCreators from 'redux';
import connect from 'react-redux';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import get from 'lodash/get';
import isArray from 'lodash/isArray';
import isString from '../../helpers/typeCheckHelper';
import classNames from 'classnames';
import * as actionCreators from '../../actions/modal';
import GenericModal from '../GenericModal';
import Notify from '../../components/Notify';
import s from './AnalyzeModal.scss';


export class AnalyzeModal extends Component

static propTypes =
data: PropTypes.object,
sendData: PropTypes.func,
isOpen: PropTypes.bool,
openModal: PropTypes.func,
closeModal: PropTypes.func,
customStyles: PropTypes.object,
wasClicked: PropTypes.bool,
isSpinner: PropTypes.bool,
toggleSpinner: PropTypes.func,
handleAnalyzeListOfBonds: PropTypes.func,
id: PropTypes.string,


constructor(props)
super(props);
this.state =
notes: '',
;
this.closeModal = this.closeModal.bind(this);
this.handleNotesChange = this.handleNotesChange.bind(this);


render()
const isOpen, customStyles, wasClicked, isSpinner, id = this.props;

return (
<GenericModal
isOpen=isOpen
style=customStyles
contentLabel="List/Portfolio Review"
>
<div className=classNames('buy-btn-modal row', s['analyze-modal'])>
<h1 className="column small-11 header">Portfolio Review</h1>
<button
className="column small-1 close-modal"
data-id=`$MODAL-close-button`
onClick=() => this.closeModal();
>X</button>
<div className="column small-12">
<div className=classNames('column small-12', s['table-container'], s['force-show-scrollbar'])>
<div className=classNames('row', s['table-header'])>
<div className=classNames('columns small-3 text-left', s['table-header-label'])>QUANTITY</div>
</div>
this.renderTableData()
</div>
<div className="column small-12 field-container">
<label
className="label column small-3 text-right"
htmlFor="notes"
>NOTES</label>
<textarea
className=classNames('notes-field', s['notes-field'])
data-id=`$MODAL-form-notes`
onChange=this.handleNotesChange
/>
</div>
<div className="column small-12 button-wrapper">
<button
className=classNames('small-4 bright-blue submit-btn', s['submit-btn'])
data-id=`$MODAL-submit-button`
onClick=() => this.handleSubmit();
disabled=!!wasClicked
>
isSpinner ?
<div className="spinner-full-page modal-spinner" /> :
'Submit'

</button>
<button
className=classNames('small-4 bright-blue cancel-btn', s['cancel-btn'])
onClick=() => this.closeModal();
>Cancel</button>
</div>
</div>
</div>
</GenericModal>
);



const mapDispatchToProps = dispatch => (
bindActionCreators(actionCreators, dispatch)
);

const mapStateToProps = state => (
isOpen: state.modal.isModalOpen,
id: state.modal.id,
wasClicked: state.modal.wasClicked,
isSpinner: state.modal.isSpinner,
data: state.modal.data,
);

export default withStyles(s)(connect(mapStateToProps, mapDispatchToProps)(AnalyzeModal));


My Test



import React from 'react';
import AnalyzeModal from '../components/AnalyzeModal';
import Link from '../components/Link';
import render, mount, shallow from 'enzyme';
import thunk from 'redux-thunk';
import configureMockStore from 'redux-mock-store';

describe('<Analyze />', () =>
// create any initial state needed to render Connected component
const initialState =
modal:
isModalOpen: false,
id: '',
wasClicked: false,
isMarkIncluded: false,
isSpinner: false,
isOpen: null,
openModal: null,
closeModal: null,
data: null,
,
;

const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
let wrapper;
let store;

beforeEach(() =>
store = mockStore(initialState);
wrapper = mount(<AnalyzeModal store=store />);
);

test('should be defined', () =>
expect(wrapper).toBeDefined();
);

test('matches the snapshot', () =>
expect(wrapper).toMatchSnapshot();
)
);


My Test Snapshot



// Jest Snapshot v1

exports[`<Analyze /> matches the snapshot 1`] = `
<Connect(AnalyzeModal)
store=
Object
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],


>
<AnalyzeModal
closeModal=[Function]
data=null
id=""
isOpen=false
isSpinner=false
openModal=[Function]
sendData=[Function]
store=
Object
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],


toggleMark=[Function]
toggleSpinner=[Function]
wasClicked=false
/>
</Connect(AnalyzeModal)>


Current behavior
Currently, the snapshot is returning the component without the JSX inside of the component itself.



Expected behavior
I expect the component to container jsx elements such as: button, div, etc.



My environment:



Version



 library | version
enzyme | "^3.9.0"
react | "^15.3.1"
react-dom | "^15.3.1"
react-test-renderer | "^15.3.1"
adapter (enzyme-adapter-react-15.4) | "^1.3.1"











share|improve this question
























  • Does GenericModal not render anything if its isOpen prop is false? (that would be my guess without being able to actually run and test anything)

    – brian-lives-outdoors
    Mar 21 at 22:24











  • It does not, so I tried two things: first, changing my initialState object to have isOpen set to true. second, performing a setProps in my first test case: wrapper.setProps( isOpen: true ). When I console.log(wrapper), it returns: ReactWrapper

    – eagercoder
    Mar 22 at 0:16











  • @brian-lives-outdoors, I think this is a good starting point. Meaning the issue, is likely related to the modal not being open. I may need to use sinon to spy on the openModal method in my reducer, to trigger the opening of the modal, but that seems like overlike. Thoughts?

    – eagercoder
    Mar 22 at 0:18











  • @brian-lives-outdoors, setting isOpen to false, didn't fix it. Any other ideas?

    – eagercoder
    Mar 25 at 19:31













1












1








1








I have a test for a React component which is being exported with connect. I was able to have my tests pass, but my Snapsnot is not what I expect it to be. I opened a GH issue with the enzyme team as well Note I took out some of the methods, since they are not applicable to the issue.



My Component



import React, Component from 'react';
import PropTypes from 'prop-types'
import bindActionCreators from 'redux';
import connect from 'react-redux';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import get from 'lodash/get';
import isArray from 'lodash/isArray';
import isString from '../../helpers/typeCheckHelper';
import classNames from 'classnames';
import * as actionCreators from '../../actions/modal';
import GenericModal from '../GenericModal';
import Notify from '../../components/Notify';
import s from './AnalyzeModal.scss';


export class AnalyzeModal extends Component

static propTypes =
data: PropTypes.object,
sendData: PropTypes.func,
isOpen: PropTypes.bool,
openModal: PropTypes.func,
closeModal: PropTypes.func,
customStyles: PropTypes.object,
wasClicked: PropTypes.bool,
isSpinner: PropTypes.bool,
toggleSpinner: PropTypes.func,
handleAnalyzeListOfBonds: PropTypes.func,
id: PropTypes.string,


constructor(props)
super(props);
this.state =
notes: '',
;
this.closeModal = this.closeModal.bind(this);
this.handleNotesChange = this.handleNotesChange.bind(this);


render()
const isOpen, customStyles, wasClicked, isSpinner, id = this.props;

return (
<GenericModal
isOpen=isOpen
style=customStyles
contentLabel="List/Portfolio Review"
>
<div className=classNames('buy-btn-modal row', s['analyze-modal'])>
<h1 className="column small-11 header">Portfolio Review</h1>
<button
className="column small-1 close-modal"
data-id=`$MODAL-close-button`
onClick=() => this.closeModal();
>X</button>
<div className="column small-12">
<div className=classNames('column small-12', s['table-container'], s['force-show-scrollbar'])>
<div className=classNames('row', s['table-header'])>
<div className=classNames('columns small-3 text-left', s['table-header-label'])>QUANTITY</div>
</div>
this.renderTableData()
</div>
<div className="column small-12 field-container">
<label
className="label column small-3 text-right"
htmlFor="notes"
>NOTES</label>
<textarea
className=classNames('notes-field', s['notes-field'])
data-id=`$MODAL-form-notes`
onChange=this.handleNotesChange
/>
</div>
<div className="column small-12 button-wrapper">
<button
className=classNames('small-4 bright-blue submit-btn', s['submit-btn'])
data-id=`$MODAL-submit-button`
onClick=() => this.handleSubmit();
disabled=!!wasClicked
>
isSpinner ?
<div className="spinner-full-page modal-spinner" /> :
'Submit'

</button>
<button
className=classNames('small-4 bright-blue cancel-btn', s['cancel-btn'])
onClick=() => this.closeModal();
>Cancel</button>
</div>
</div>
</div>
</GenericModal>
);



const mapDispatchToProps = dispatch => (
bindActionCreators(actionCreators, dispatch)
);

const mapStateToProps = state => (
isOpen: state.modal.isModalOpen,
id: state.modal.id,
wasClicked: state.modal.wasClicked,
isSpinner: state.modal.isSpinner,
data: state.modal.data,
);

export default withStyles(s)(connect(mapStateToProps, mapDispatchToProps)(AnalyzeModal));


My Test



import React from 'react';
import AnalyzeModal from '../components/AnalyzeModal';
import Link from '../components/Link';
import render, mount, shallow from 'enzyme';
import thunk from 'redux-thunk';
import configureMockStore from 'redux-mock-store';

describe('<Analyze />', () =>
// create any initial state needed to render Connected component
const initialState =
modal:
isModalOpen: false,
id: '',
wasClicked: false,
isMarkIncluded: false,
isSpinner: false,
isOpen: null,
openModal: null,
closeModal: null,
data: null,
,
;

const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
let wrapper;
let store;

beforeEach(() =>
store = mockStore(initialState);
wrapper = mount(<AnalyzeModal store=store />);
);

test('should be defined', () =>
expect(wrapper).toBeDefined();
);

test('matches the snapshot', () =>
expect(wrapper).toMatchSnapshot();
)
);


My Test Snapshot



// Jest Snapshot v1

exports[`<Analyze /> matches the snapshot 1`] = `
<Connect(AnalyzeModal)
store=
Object
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],


>
<AnalyzeModal
closeModal=[Function]
data=null
id=""
isOpen=false
isSpinner=false
openModal=[Function]
sendData=[Function]
store=
Object
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],


toggleMark=[Function]
toggleSpinner=[Function]
wasClicked=false
/>
</Connect(AnalyzeModal)>


Current behavior
Currently, the snapshot is returning the component without the JSX inside of the component itself.



Expected behavior
I expect the component to container jsx elements such as: button, div, etc.



My environment:



Version



 library | version
enzyme | "^3.9.0"
react | "^15.3.1"
react-dom | "^15.3.1"
react-test-renderer | "^15.3.1"
adapter (enzyme-adapter-react-15.4) | "^1.3.1"











share|improve this question
















I have a test for a React component which is being exported with connect. I was able to have my tests pass, but my Snapsnot is not what I expect it to be. I opened a GH issue with the enzyme team as well Note I took out some of the methods, since they are not applicable to the issue.



My Component



import React, Component from 'react';
import PropTypes from 'prop-types'
import bindActionCreators from 'redux';
import connect from 'react-redux';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import get from 'lodash/get';
import isArray from 'lodash/isArray';
import isString from '../../helpers/typeCheckHelper';
import classNames from 'classnames';
import * as actionCreators from '../../actions/modal';
import GenericModal from '../GenericModal';
import Notify from '../../components/Notify';
import s from './AnalyzeModal.scss';


export class AnalyzeModal extends Component

static propTypes =
data: PropTypes.object,
sendData: PropTypes.func,
isOpen: PropTypes.bool,
openModal: PropTypes.func,
closeModal: PropTypes.func,
customStyles: PropTypes.object,
wasClicked: PropTypes.bool,
isSpinner: PropTypes.bool,
toggleSpinner: PropTypes.func,
handleAnalyzeListOfBonds: PropTypes.func,
id: PropTypes.string,


constructor(props)
super(props);
this.state =
notes: '',
;
this.closeModal = this.closeModal.bind(this);
this.handleNotesChange = this.handleNotesChange.bind(this);


render()
const isOpen, customStyles, wasClicked, isSpinner, id = this.props;

return (
<GenericModal
isOpen=isOpen
style=customStyles
contentLabel="List/Portfolio Review"
>
<div className=classNames('buy-btn-modal row', s['analyze-modal'])>
<h1 className="column small-11 header">Portfolio Review</h1>
<button
className="column small-1 close-modal"
data-id=`$MODAL-close-button`
onClick=() => this.closeModal();
>X</button>
<div className="column small-12">
<div className=classNames('column small-12', s['table-container'], s['force-show-scrollbar'])>
<div className=classNames('row', s['table-header'])>
<div className=classNames('columns small-3 text-left', s['table-header-label'])>QUANTITY</div>
</div>
this.renderTableData()
</div>
<div className="column small-12 field-container">
<label
className="label column small-3 text-right"
htmlFor="notes"
>NOTES</label>
<textarea
className=classNames('notes-field', s['notes-field'])
data-id=`$MODAL-form-notes`
onChange=this.handleNotesChange
/>
</div>
<div className="column small-12 button-wrapper">
<button
className=classNames('small-4 bright-blue submit-btn', s['submit-btn'])
data-id=`$MODAL-submit-button`
onClick=() => this.handleSubmit();
disabled=!!wasClicked
>
isSpinner ?
<div className="spinner-full-page modal-spinner" /> :
'Submit'

</button>
<button
className=classNames('small-4 bright-blue cancel-btn', s['cancel-btn'])
onClick=() => this.closeModal();
>Cancel</button>
</div>
</div>
</div>
</GenericModal>
);



const mapDispatchToProps = dispatch => (
bindActionCreators(actionCreators, dispatch)
);

const mapStateToProps = state => (
isOpen: state.modal.isModalOpen,
id: state.modal.id,
wasClicked: state.modal.wasClicked,
isSpinner: state.modal.isSpinner,
data: state.modal.data,
);

export default withStyles(s)(connect(mapStateToProps, mapDispatchToProps)(AnalyzeModal));


My Test



import React from 'react';
import AnalyzeModal from '../components/AnalyzeModal';
import Link from '../components/Link';
import render, mount, shallow from 'enzyme';
import thunk from 'redux-thunk';
import configureMockStore from 'redux-mock-store';

describe('<Analyze />', () =>
// create any initial state needed to render Connected component
const initialState =
modal:
isModalOpen: false,
id: '',
wasClicked: false,
isMarkIncluded: false,
isSpinner: false,
isOpen: null,
openModal: null,
closeModal: null,
data: null,
,
;

const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
let wrapper;
let store;

beforeEach(() =>
store = mockStore(initialState);
wrapper = mount(<AnalyzeModal store=store />);
);

test('should be defined', () =>
expect(wrapper).toBeDefined();
);

test('matches the snapshot', () =>
expect(wrapper).toMatchSnapshot();
)
);


My Test Snapshot



// Jest Snapshot v1

exports[`<Analyze /> matches the snapshot 1`] = `
<Connect(AnalyzeModal)
store=
Object
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],


>
<AnalyzeModal
closeModal=[Function]
data=null
id=""
isOpen=false
isSpinner=false
openModal=[Function]
sendData=[Function]
store=
Object
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],


toggleMark=[Function]
toggleSpinner=[Function]
wasClicked=false
/>
</Connect(AnalyzeModal)>


Current behavior
Currently, the snapshot is returning the component without the JSX inside of the component itself.



Expected behavior
I expect the component to container jsx elements such as: button, div, etc.



My environment:



Version



 library | version
enzyme | "^3.9.0"
react | "^15.3.1"
react-dom | "^15.3.1"
react-test-renderer | "^15.3.1"
adapter (enzyme-adapter-react-15.4) | "^1.3.1"








reactjs redux jestjs enzyme react-modal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 14:44









Şivā SankĂr

1,25411022




1,25411022










asked Mar 21 at 18:06









eagercodereagercoder

10213




10213












  • Does GenericModal not render anything if its isOpen prop is false? (that would be my guess without being able to actually run and test anything)

    – brian-lives-outdoors
    Mar 21 at 22:24











  • It does not, so I tried two things: first, changing my initialState object to have isOpen set to true. second, performing a setProps in my first test case: wrapper.setProps( isOpen: true ). When I console.log(wrapper), it returns: ReactWrapper

    – eagercoder
    Mar 22 at 0:16











  • @brian-lives-outdoors, I think this is a good starting point. Meaning the issue, is likely related to the modal not being open. I may need to use sinon to spy on the openModal method in my reducer, to trigger the opening of the modal, but that seems like overlike. Thoughts?

    – eagercoder
    Mar 22 at 0:18











  • @brian-lives-outdoors, setting isOpen to false, didn't fix it. Any other ideas?

    – eagercoder
    Mar 25 at 19:31

















  • Does GenericModal not render anything if its isOpen prop is false? (that would be my guess without being able to actually run and test anything)

    – brian-lives-outdoors
    Mar 21 at 22:24











  • It does not, so I tried two things: first, changing my initialState object to have isOpen set to true. second, performing a setProps in my first test case: wrapper.setProps( isOpen: true ). When I console.log(wrapper), it returns: ReactWrapper

    – eagercoder
    Mar 22 at 0:16











  • @brian-lives-outdoors, I think this is a good starting point. Meaning the issue, is likely related to the modal not being open. I may need to use sinon to spy on the openModal method in my reducer, to trigger the opening of the modal, but that seems like overlike. Thoughts?

    – eagercoder
    Mar 22 at 0:18











  • @brian-lives-outdoors, setting isOpen to false, didn't fix it. Any other ideas?

    – eagercoder
    Mar 25 at 19:31
















Does GenericModal not render anything if its isOpen prop is false? (that would be my guess without being able to actually run and test anything)

– brian-lives-outdoors
Mar 21 at 22:24





Does GenericModal not render anything if its isOpen prop is false? (that would be my guess without being able to actually run and test anything)

– brian-lives-outdoors
Mar 21 at 22:24













It does not, so I tried two things: first, changing my initialState object to have isOpen set to true. second, performing a setProps in my first test case: wrapper.setProps( isOpen: true ). When I console.log(wrapper), it returns: ReactWrapper

– eagercoder
Mar 22 at 0:16





It does not, so I tried two things: first, changing my initialState object to have isOpen set to true. second, performing a setProps in my first test case: wrapper.setProps( isOpen: true ). When I console.log(wrapper), it returns: ReactWrapper

– eagercoder
Mar 22 at 0:16













@brian-lives-outdoors, I think this is a good starting point. Meaning the issue, is likely related to the modal not being open. I may need to use sinon to spy on the openModal method in my reducer, to trigger the opening of the modal, but that seems like overlike. Thoughts?

– eagercoder
Mar 22 at 0:18





@brian-lives-outdoors, I think this is a good starting point. Meaning the issue, is likely related to the modal not being open. I may need to use sinon to spy on the openModal method in my reducer, to trigger the opening of the modal, but that seems like overlike. Thoughts?

– eagercoder
Mar 22 at 0:18













@brian-lives-outdoors, setting isOpen to false, didn't fix it. Any other ideas?

– eagercoder
Mar 25 at 19:31





@brian-lives-outdoors, setting isOpen to false, didn't fix it. Any other ideas?

– eagercoder
Mar 25 at 19:31












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286687%2funable-to-access-react-modal-component-jsx-when-exported-with-redux%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286687%2funable-to-access-react-modal-component-jsx-when-exported-with-redux%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현