Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: react 17 support #399

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/jest/setup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jsdom from 'jsdom'
import sinon from 'sinon'
import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import Adapter from '@wojtekmaj/enzyme-adapter-react-17'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enzymejs/enzyme#2429 (comment) indicates that the Enzyme maintainers won't be releasing support soon, so here's the drop-in replacement.

import '@babel/polyfill'

Enzyme.configure({ adapter: new Adapter() })
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"peerDependencies": {
"react": ">15.4.2 <17.0.0",
"react-dom": ">15.4.2 <17.0.0"
"react": ">15.4.2",
"react-dom": ">15.4.2"
},
"files": [
"dist/**/*"
Expand All @@ -57,10 +57,11 @@
"@commitlint/config-conventional": "^8.3.4",
"@types/jquery": "^3.5.6",
"@types/node": "^14.0.13",
"@types/react": "^16.9.56",
"@types/react-dom": "^16.9.9",
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
Expand All @@ -69,7 +70,6 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"coveralls": "^2.11.9",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.5.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "~17.1.0",
"eslint-config-airbnb-base": "~13.1.0",
Expand All @@ -90,8 +90,8 @@
"packwatch": "^1.0.0",
"prettier": "^1.14.2",
"prettier-eslint": "^9.0.1",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rimraf": "2.5.4",
"sass": "^1.37.4",
"semantic-release": "^17.0.4",
Expand Down
17 changes: 12 additions & 5 deletions src/components/__tests__/RootModal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,29 @@ describe('RootModal', function() {
beforeEach(() => {
jest.resetModules()

const rootElement = document.createElement('div')
document.body.appendChild(rootElement)

this.getRootElement = () => {
return rootElement
}

this.makeSubject = () => {
return mount(
<RootModal>
<div className="root">foo</div>
<div className="content">foo</div>
</RootModal>,
{
attachTo: document.body,
attachTo: rootElement,
},
)
}
})

it('should has a div.root tag', () => {
it('should has a div.content tag', () => {
const subject = this.makeSubject()

expect(subject.find('div.root').length).toBeTruthy()
expect(subject.find('div.content').length).toBeTruthy()
})

it('should has parent element which has specific className', () => {
Expand All @@ -46,6 +53,6 @@ describe('RootModal', function() {
const subject = this.makeSubject()

subject.unmount()
expect(document.body.querySelector('.iti-container')).toBeNull()
expect(this.getRootElement().querySelector('.iti-container')).toBeNull()
})
})
Loading