Skip to content

Commit

Permalink
Merge pull request #48 from CanopyTax/issue-47
Browse files Browse the repository at this point in the history
Making Parcel component work in IE11
  • Loading branch information
joeldenning authored Apr 11, 2019
2 parents 492bf78 + 4876909 commit 24c240d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/parcel.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class Parcel extends React.Component {
})
}
getParcelProps = () => {
const parcelProps = Object.assign({}, this.props)
const parcelProps = {...this.props}

delete parcelProps.mountParcel
delete parcelProps.config
Expand Down
12 changes: 10 additions & 2 deletions src/parcel.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Parcel from './parcel.js'
import {mount} from 'enzyme'
import {SingleSpaContext} from '../lib/single-spa-react.js'

document.body.appendChild = jest.fn()

Expand Down Expand Up @@ -136,6 +134,16 @@ describe(`<Parcel />`, () => {
triggerComponentDidUpdate()
})

it(`calls mountParcel with the all the React props`, () => {
const wrapper = mount(<Parcel {...props} />)
// We need to wait for a microtask to finish before the Parcel component will have called mountParcel
return Promise.resolve().then(() => {
expect(mountParcel).toHaveBeenCalled()
const parcelProps = mountParcel.mock.calls[0][1]
expect(parcelProps.domElement).toBeInstanceOf(HTMLDivElement)
})
})

// https://github.com/airbnb/enzyme/pull/1513 isn't published, waaaaaaaaaaaaa :'(
// it(`lets you not pass in a mountParcel prop if the SingleSpaContext is set with one`, () => {
// // this creates the SingleSpaContext
Expand Down

0 comments on commit 24c240d

Please sign in to comment.