Skip to content

Commit ba43d86

Browse files
authored
Upgrade react version (#1135)
* upgrading packages + fixing tests and transitions * Fix invalid ref * Fix versioning * Formatting package.json * preventing warnings from showing in the tests * Make just run tests serially * removing unused ref
1 parent e9feefa commit ba43d86

File tree

16 files changed

+1224
-665
lines changed

16 files changed

+1224
-665
lines changed

.vscode/settings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
// Place your settings in this file to overwrite default and user settings.
21
{
2+
// Place your settings in this file to overwrite default and user settings.
33
"search.exclude": {
44
"**/node_modules": true,
55
"**/bower_components": true,
66
"**/lib": true,
7-
"**/coverage": true
7+
"**/coverage": true,
8+
"**/examples": true
89
},
910
"editor.formatOnSave": true,
1011
"prettier.printWidth": 100,
1112
"prettier.singleQuote": true
12-
}
13+
}

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ module.exports = function(grunt) {
8282
port: 3000,
8383
https: true,
8484
webpack: {
85-
devtool: 'eval'
85+
devtool: 'cheap-module-source-map'
8686
}
8787
},
8888
design: {
@@ -92,7 +92,7 @@ module.exports = function(grunt) {
9292
path: path.join(__dirname, 'build'),
9393
filename: 'lock.design.js'
9494
},
95-
devtool: 'eval'
95+
devtool: 'cheap-module-source-map'
9696
}
9797
}
9898
},

css/_transitions.styl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
/*Slide out*/
1616

17-
.slide-leave {
17+
.slide-exit {
1818
-webkit-transform: translate3d(0, 0, 0);
1919
transform: translate3d(0, 0, 0);
2020
}
2121

22-
.slide-leave.slide-leave-active {
22+
.slide-exit.slide-exit-active {
2323
-webkit-transform: translate3d(100%, 0, 0);
2424
transform: translate3d(100%, 0, 0);
2525
-webkit-transition: -webkit-transform .3s ease-in;
@@ -58,13 +58,13 @@
5858

5959
/*vslide out*/
6060

61-
.vslide-leave {
61+
.vslide-exit {
6262
-webkit-transform: translate3d(0, 0, 0);
6363
transform: translate3d(0, 0, 0);
6464
}
6565

6666

67-
.vslide-leave.vslide-leave-active {
67+
.vslide-exit.vslide-exit-active {
6868
-webkit-transform: translate3d(0, 100%, 0);
6969
transform: translate3d(0, 100%, 0);
7070
-webkit-transition: -webkit-transform .35s;
@@ -93,15 +93,15 @@
9393

9494
/*Horizontal fade out*/
9595

96-
.horizontal-fade-leave {
96+
.horizontal-fade-exit {
9797
opacity: 1;
9898
position: absolute;
9999
width: 100%;
100100
top: 0;
101101
left: 0;
102102
}
103103

104-
.horizontal-fade-leave.horizontal-fade-leave-active {
104+
.horizontal-fade-exit.horizontal-fade-exit-active {
105105
opacity: 0;
106106
-webkit-transform: translate3d(-100%, 0, 0);
107107
transform: translate3d(-100%, 0, 0);
@@ -132,15 +132,15 @@
132132

133133
/* reverse horizontal fade out */
134134

135-
.reverse-horizontal-fade-leave {
135+
.reverse-horizontal-fade-exit {
136136
opacity: 1;
137137
position: absolute;
138138
width: 100%;
139139
top: 0;
140140
left: 0;
141141
}
142142

143-
.reverse-horizontal-fade-leave.reverse-horizontal-fade-leave-active {
143+
.reverse-horizontal-fade-exit.reverse-horizontal-fade-exit-active {
144144
opacity: 0;
145145
-webkit-transform: translate3d(100%, 0, 0);
146146
transform: translate3d(100%, 0, 0);
@@ -163,7 +163,7 @@
163163

164164
/* fade out*/
165165

166-
.fade-leave {
166+
.fade-exit {
167167
opacity: 1;
168168
position: absolute;
169169
width: 100%;
@@ -173,7 +173,7 @@
173173
opacity: 1;
174174
}
175175

176-
.fade-leave.fade-leave-active {
176+
.fade-exit.fade-exit-active {
177177
opacity: 0;
178178

179179
-webkit-transition: opacity .5s linear;

css/index.styl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ tabsHeight = 40px
5858
paddingTop 10px
5959
paddingBottom 10px
6060

61-
&.global-message-leave
61+
&.global-message-exit
6262
transition all 0.2s
6363
height 0
6464
paddingTop 0
@@ -132,7 +132,7 @@ tabsHeight = 40px
132132
background white
133133
position relative
134134

135-
&.horizontal-fade-leave
135+
&.horizontal-fade-exit
136136
.auth0-lock-content, .auth0-lock-terms
137137
opacity .3
138138
pointer-events none

package.json

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@
44
"description": "Auth0 Lock",
55
"author": "Auth0 <[email protected]> (http://auth0.com)",
66
"license": "MIT",
7-
"keywords": [
8-
"auth0",
9-
"auth",
10-
"openid",
11-
"authentication",
12-
"passwordless",
13-
"browser",
14-
"jwt"
15-
],
7+
"keywords": ["auth0", "auth", "openid", "authentication", "passwordless", "browser", "jwt"],
168
"repository": {
179
"type": "git",
1810
"url": "git://github.com/auth0/lock"
@@ -28,10 +20,13 @@
2820
"precommit": "lint-staged",
2921
"lint": "eslint --ext .jsx,.js src/",
3022
"test": "cross-env BABEL_ENV=test zuul -- test/**/*.test.js",
31-
"test:browser": "cross-env BABEL_ENV=test zuul --local 8080 --disable-tunnel -- test/**/*.test.js",
32-
"test:cli": "cross-env BABEL_ENV=test mochify --extension=.jsx --transform=babelify test/**/*.test.js",
33-
"test:watch": "cross-env BABEL_ENV=test mochify --watch --extension=.jsx --transform=babelify test/**/*.test.js",
34-
"test:jest": "jest --coverage",
23+
"test:browser":
24+
"cross-env BABEL_ENV=test zuul --local 8080 --disable-tunnel -- test/**/*.test.js",
25+
"test:cli":
26+
"cross-env BABEL_ENV=test mochify --extension=.jsx --transform=babelify ./test/setup.js test/**/*.test.js",
27+
"test:watch":
28+
"cross-env BABEL_ENV=test mochify --watch --extension=.jsx --transform=babelify ./test/setup.js test/**/*.test.js",
29+
"test:jest": "jest --coverage --runInBand",
3530
"test:jest:watch": "jest --watch --coverage",
3631
"publish:cdn": "ccu",
3732
"release": "scripts/release.sh",
@@ -45,15 +40,16 @@
4540
"babel-plugin-transform-css-import-to-string": "0.0.2",
4641
"babel-plugin-version-inline": "^1.0.0",
4742
"babel-preset-es2015": "^6.22.0",
48-
"babel-preset-react": "^6.16.0",
43+
"babel-preset-react": "^6.24.1",
4944
"babel-preset-stage-0": "^6.3.13",
5045
"babelify": "^7.2.0",
5146
"bump-version": "^0.5.0",
5247
"component-cdn-uploader": "auth0/component-cdn-uploader#v1.3.0",
5348
"cross-env": "^3.1.4",
5449
"css-loader": "^0.26.1",
5550
"dotenv": "^4.0.0",
56-
"enzyme": "2.7.0",
51+
"enzyme": "^3.1.0",
52+
"enzyme-adapter-react-16": "^1.0.1",
5753
"eslint": "^3.19.0",
5854
"eslint-config-prettier": "^1.7.0",
5955
"eslint-plugin-react": "^6.10.3",
@@ -68,14 +64,13 @@
6864
"grunt-exec": "^0.4.6",
6965
"grunt-webpack": "^2.0.1",
7066
"husky": "^0.13.3",
71-
"jest": "19.0.0",
67+
"jest": "^21.2.1",
7268
"json-beautify": "^1.0.1",
7369
"jsonwebtoken": "^7.3.0",
7470
"lint-staged": "^3.4.0",
75-
"mochify": "^2.12.0",
71+
"mochify": "^3.3.0",
7672
"prettier": "^1.2.2",
77-
"react-addons-test-utils": "^15.6.0",
78-
"react-test-renderer": "^15.6.1",
73+
"react-test-renderer": "^16.0.0",
7974
"semver": "^5.3.0",
8075
"sinon": "^1.15.4",
8176
"stylus": "^0.54.5",
@@ -98,10 +93,10 @@
9893
"immutable": "^3.7.3",
9994
"jsonp": "^0.2.0",
10095
"password-sheriff": "^1.1.0",
101-
"prop-types": "^15.5.10",
96+
"prop-types": "^15.6.0",
10297
"react": "^15.6.1 || ^16.0.0",
10398
"react-dom": "^15.6.1 || ^16.0.0",
104-
"react-transition-group": "^1.2.0",
99+
"react-transition-group": "^2.2.1",
105100
"superagent": "^3.3.1",
106101
"trim": "0.0.1",
107102
"url-join": "^1.1.0"
@@ -114,32 +109,25 @@
114109
"localPath": "build"
115110
},
116111
"jest": {
117-
"modulePaths": [
118-
"<rootDir>/src/",
119-
"<rootDir>/src/__tests__"
120-
],
112+
"modulePaths": ["<rootDir>/src/", "<rootDir>/src/__tests__"],
113+
"setupFiles": ["<rootDir>/src/__tests__/setup-tests.js"],
121114
"coveragePathIgnorePatterns": [
122115
"/node_modules/",
123116
"<rootDir>/test/",
124117
"<rootDir>/lib/",
125-
"<rootDir>/src/__tests__/testUtils.js"
118+
"<rootDir>/src/__tests__/testUtils.js",
119+
"<rootDir>/src/__tests__/setup-tests.js"
126120
],
127121
"testPathIgnorePatterns": [
128122
"/node_modules/",
129123
"<rootDir>/test/",
130124
"<rootDir>/lib/",
131-
"<rootDir>/src/__tests__/testUtils.js"
125+
"<rootDir>/src/__tests__/testUtils.js",
126+
"<rootDir>/src/__tests__/setup-tests.js"
132127
],
133-
"coverageReporters": [
134-
"lcov",
135-
"text-summary"
136-
]
128+
"coverageReporters": ["lcov", "text-summary"]
137129
},
138130
"lint-staged": {
139-
"*.{js,jsx}": [
140-
"npm run lint",
141-
"prettier --write --print-width 100 --single-quote",
142-
"git add"
143-
]
131+
"*.{js,jsx}": ["npm run lint", "prettier --write --print-width 100 --single-quote", "git add"]
144132
}
145133
}

src/__tests__/core/__snapshots__/index.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ exports[`setResolvedConnection sets the connection 1`] = `
66
Array [
77
"m",
88
"resolvedConnection",
9-
Object {
10-
"name": "bar",
9+
Immutable.Map {
1110
"type": "database",
11+
"name": "bar",
1212
},
1313
]
1414
`;

src/__tests__/field/__snapshots__/username.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Object {
99

1010
exports[`field/username setUsername() calls setField 1`] = `
1111
Array [
12-
Object {
12+
Immutable.Map {
1313
"validation": null,
1414
},
1515
"username",

src/__tests__/setup-tests.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// setup file
2+
import { configure } from 'enzyme';
3+
import Adapter from 'enzyme-adapter-react-16';
4+
5+
jest.mock('react-dom/node_modules/fbjs/lib/warning');
6+
7+
configure({ adapter: new Adapter() });
8+
9+
//jest polyfills
10+
global.requestAnimationFrame = function(callback) {
11+
setTimeout(callback, 0);
12+
};

src/__tests__/ui/box/global_message.test.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('GlobalMessage', () => {
1919
wrapper.getDOMNode().getBoundingClientRect = getBoundingClientRectSpy;
2020
wrapper.getDOMNode().scrollIntoView = scrollIntoViewSpy;
2121

22-
wrapper.getNode().componentDidMount();
22+
wrapper.instance().componentDidMount();
2323

2424
expect(getBoundingClientRectSpy).toHaveBeenCalled();
2525
expect(scrollIntoViewSpy).toHaveBeenCalledWith(true);
@@ -31,7 +31,7 @@ describe('GlobalMessage', () => {
3131
wrapper.getDOMNode().getBoundingClientRect = getBoundingClientRectSpy;
3232
wrapper.getDOMNode().scrollIntoView = scrollIntoViewSpy;
3333

34-
wrapper.getNode().componentDidMount();
34+
wrapper.instance().componentDidMount();
3535

3636
expect(getBoundingClientRectSpy).toHaveBeenCalled();
3737
expect(scrollIntoViewSpy).not.toHaveBeenCalled();
@@ -43,7 +43,7 @@ describe('GlobalMessage', () => {
4343
wrapper.getDOMNode().getBoundingClientRect = getBoundingClientRectSpy;
4444
wrapper.getDOMNode().scrollIntoView = scrollIntoViewSpy;
4545

46-
wrapper.getNode().componentDidMount();
46+
wrapper.instance().componentDidMount();
4747

4848
expect(getBoundingClientRectSpy).toHaveBeenCalled();
4949
expect(scrollIntoViewSpy).toHaveBeenCalledWith(true);
@@ -55,7 +55,7 @@ describe('GlobalMessage', () => {
5555
wrapper.getDOMNode().getBoundingClientRect = getBoundingClientRectSpy;
5656
wrapper.getDOMNode().scrollIntoView = scrollIntoViewSpy;
5757

58-
wrapper.getNode().componentDidMount();
58+
wrapper.instance().componentDidMount();
5959

6060
expect(scrollIntoViewSpy).not.toHaveBeenCalled();
6161
});

src/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default class Base extends EventEmitter {
120120
tabs: screen.renderTabs(m),
121121
terms: screen.renderTerms(m, i18nProp.html('signUpTerms')),
122122
title: getScreenTitle(m),
123-
transitionName: screen.name === 'loading' ? 'fade' : 'horizontal-fade',
123+
classNames: screen.name === 'loading' ? 'fade' : 'horizontal-fade',
124124
scrollGlobalMessagesIntoView: l.ui.scrollGlobalMessagesIntoView(m)
125125
};
126126
render(l.ui.containerID(m), props);

0 commit comments

Comments
 (0)