diff --git a/.babelrc b/.babelrc
index cd75116..2d80670 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,4 +1,4 @@
{
- "presets": ["env", "react"],
- "plugins": ["transform-object-rest-spread"]
+ "presets": ["@babel/env", "@babel/react"],
+ "plugins": ["@babel/plugin-proposal-object-rest-spread"]
}
\ No newline at end of file
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 0000000..9cf9495
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1 @@
+package-lock=false
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index d4ae36c..aeb0f71 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,10 @@
language: node_js
node_js:
- - "10"
+ - "14"
+ - "16"
+before_install:
+ - npm install -g npm-install-peers
+ - npm-install-peers
script:
- npm test
- npm run build
diff --git a/__tests__/__snapshots__/checkbox-svg-map.test.js.snap b/__tests__/__snapshots__/checkbox-svg-map.test.js.snap
index 1618cb5..8a00dce 100644
--- a/__tests__/__snapshots__/checkbox-svg-map.test.js.snap
+++ b/__tests__/__snapshots__/checkbox-svg-map.test.js.snap
@@ -83,13 +83,8 @@ exports[`CheckboxSVGMap component Rendering displays map with default props 1`]
d="path0"
id="id0"
name="name0"
- onBlur={undefined}
onClick={[Function]}
- onFocus={undefined}
onKeyDown={[Function]}
- onMouseMove={undefined}
- onMouseOut={undefined}
- onMouseOver={undefined}
role="checkbox"
tabIndex="0"
/>
@@ -100,13 +95,8 @@ exports[`CheckboxSVGMap component Rendering displays map with default props 1`]
d="path1"
id="id1"
name="name1"
- onBlur={undefined}
onClick={[Function]}
- onFocus={undefined}
onKeyDown={[Function]}
- onMouseMove={undefined}
- onMouseOut={undefined}
- onMouseOver={undefined}
role="checkbox"
tabIndex="0"
/>
@@ -117,13 +107,8 @@ exports[`CheckboxSVGMap component Rendering displays map with default props 1`]
d="path2"
id="id2"
name="name2"
- onBlur={undefined}
onClick={[Function]}
- onFocus={undefined}
onKeyDown={[Function]}
- onMouseMove={undefined}
- onMouseOut={undefined}
- onMouseOver={undefined}
role="checkbox"
tabIndex="0"
/>
diff --git a/__tests__/__snapshots__/radio-svg-map.test.js.snap b/__tests__/__snapshots__/radio-svg-map.test.js.snap
index 3dc7ed9..46326e2 100644
--- a/__tests__/__snapshots__/radio-svg-map.test.js.snap
+++ b/__tests__/__snapshots__/radio-svg-map.test.js.snap
@@ -83,13 +83,8 @@ exports[`RadioSVGMap component Rendering displays map with default props 1`] = `
d="path0"
id="id0"
name="name0"
- onBlur={undefined}
onClick={[Function]}
- onFocus={undefined}
onKeyDown={[Function]}
- onMouseMove={undefined}
- onMouseOut={undefined}
- onMouseOver={undefined}
role="radio"
tabIndex="0"
/>
@@ -100,13 +95,8 @@ exports[`RadioSVGMap component Rendering displays map with default props 1`] = `
d="path1"
id="id1"
name="name1"
- onBlur={undefined}
onClick={[Function]}
- onFocus={undefined}
onKeyDown={[Function]}
- onMouseMove={undefined}
- onMouseOut={undefined}
- onMouseOver={undefined}
role="radio"
tabIndex="-1"
/>
@@ -117,13 +107,8 @@ exports[`RadioSVGMap component Rendering displays map with default props 1`] = `
d="path2"
id="id2"
name="name2"
- onBlur={undefined}
onClick={[Function]}
- onFocus={undefined}
onKeyDown={[Function]}
- onMouseMove={undefined}
- onMouseOut={undefined}
- onMouseOver={undefined}
role="radio"
tabIndex="-1"
/>
diff --git a/__tests__/__snapshots__/svg-map.test.js.snap b/__tests__/__snapshots__/svg-map.test.js.snap
index 454ca38..5b84154 100644
--- a/__tests__/__snapshots__/svg-map.test.js.snap
+++ b/__tests__/__snapshots__/svg-map.test.js.snap
@@ -9,53 +9,29 @@ exports[`SVGMap component Properties displays map with custom function location
xmlns="http://www.w3.org/2000/svg"
>
@@ -139,53 +115,29 @@ exports[`SVGMap component Properties displays map with default props 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
diff --git a/jest-setup.js b/jest-setup.js
index 82edfc9..408047b 100644
--- a/jest-setup.js
+++ b/jest-setup.js
@@ -1,4 +1,5 @@
import { configure } from 'enzyme';
-import Adapter from 'enzyme-adapter-react-16';
+
+import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
configure({ adapter: new Adapter() });
diff --git a/jest.config.js b/jest.config.js
index 621f69b..9b5ebea 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,7 +1,10 @@
module.exports = {
// Fix "localStorage is not available for opaque origins" error
// https://github.com/jsdom/jsdom/issues/2304
- testURL: 'http://localhost',
+ testEnvironmentOptions: {
+ url: 'http://localhost',
+ },
+ testEnvironment: 'jsdom',
// Mock imported scss file
// https://jestjs.io/docs/en/webpack.html#handling-static-assets
@@ -9,7 +12,7 @@ module.exports = {
'\\.scss$': '/__tests__/__mocks__/styleMock.js'
},
- setupTestFrameworkScriptFile: '/jest-setup.js',
+ setupFilesAfterEnv: ['/jest-setup.js'],
testMatch: ['**/__tests__/**/*.test.js'],
collectCoverage: true,
coverageDirectory: './coverage/',
diff --git a/package.json b/package.json
index 4a81d90..408e4c6 100644
--- a/package.json
+++ b/package.json
@@ -6,8 +6,9 @@
"scripts": {
"start": "webpack-dev-server --mode development --open --config webpack.examples.config.js",
"build": "webpack --mode production",
- "lint": "eslint src/*.js* src/maps/*.js",
+ "lint": "eslint ./src/*.js*",
"test": "jest",
+ "test:update": "jest --updateSnapshot",
"build-demo": "webpack --mode production --config webpack.examples.config.js && cp examples/dist/* docs",
"build-tests": "jest -u",
"prepare": "npm run lint && npm test && npm run build"
@@ -36,43 +37,41 @@
"/lib"
],
"devDependencies": {
- "@svg-maps/australia": "^1.1.0",
- "@svg-maps/france.regions": "^1.1.0",
+ "@babel/core": "^7.20.2",
+ "@babel/plugin-proposal-object-rest-spread": "^7.20.2",
+ "@babel/preset-env": "^7.20.2",
+ "@babel/preset-react": "^7.18.6",
+ "@svg-maps/australia": "^1.1.1",
+ "@svg-maps/france.regions": "^1.1.1",
"@svg-maps/taiwan.main": "^1.0.0",
- "@svg-maps/usa": "^1.1.0",
- "@svg-maps/usa.utah": "^1.1.0",
- "babel-core": "^6.26.3",
- "babel-jest": "^22.4.4",
- "babel-loader": "^7.1.5",
- "babel-plugin-transform-object-rest-spread": "^6.26.0",
- "babel-preset-env": "^1.7.0",
- "babel-preset-react": "^6.24.1",
- "css-loader": "^0.28.11",
+ "@svg-maps/usa": "^1.1.1",
+ "@svg-maps/usa.utah": "^1.1.1",
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
+ "babel-jest": "^29.3.1",
+ "babel-loader": "^9.1.0",
+ "css-loader": "^6.7.2",
"enzyme": "^3.11.0",
- "enzyme-adapter-react-16": "^1.15.2",
- "eslint": "^4.19.1",
- "eslint-loader": "^2.2.1",
- "eslint-plugin-jest": "^21.27.2",
- "eslint-plugin-react": "^7.17.0",
- "html-loader": "^0.5.5",
- "html-webpack-plugin": "^3.2.0",
- "jest": "^22.4.4",
- "mini-css-extract-plugin": "^0.2.0",
- "node-sass": "^4.13.0",
- "react": "16.1.0",
- "react-dom": "16.1.0",
- "react-test-renderer": "16.1.0",
- "sass-loader": "^6.0.7",
- "style-loader": "^0.20.3",
- "webpack": "^4.41.5",
- "webpack-cli": "^3.3.10",
- "webpack-dev-server": "^3.10.1"
+ "eslint": "^8.28.0",
+ "eslint-plugin-jest": "^27.1.5",
+ "eslint-plugin-react": "^7.31.11",
+ "html-loader": "^4.2.0",
+ "html-webpack-plugin": "^5.5.0",
+ "jest": "^29.3.1",
+ "jest-environment-jsdom": "^29.3.1",
+ "mini-css-extract-plugin": "^2.7.0",
+ "react-test-renderer": "^17.0.2",
+ "sass": "^1.56.1",
+ "sass-loader": "^13.2.0",
+ "style-loader": "^3.3.1",
+ "webpack": "^5.75.0",
+ "webpack-cli": "^5.0.0",
+ "webpack-dev-server": "^4.11.1"
},
"dependencies": {
- "prop-types": "^15.7.2"
+ "prop-types": "^15.8.1"
},
"peerDependencies": {
- "react": "^16.0.0",
- "react-dom": "^16.0.0"
+ "react": "^16 || ^17",
+ "react-dom": "^16 || ^17"
}
}
diff --git a/webpack.config.js b/webpack.config.js
index 0b07811..a667d64 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -15,10 +15,7 @@ module.exports = {
test: /\.jsx?/,
exclude: /node_modules/,
use: [
- 'babel-loader',
- {
- loader: 'eslint-loader'
- }
+ 'babel-loader'
],
}, {
test: /\.scss$/,