Unverified Commit 22005080 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Upgrade react-hot-loader (#4277)

Fixes zeit/styled-jsx#425
Fixes #4246
Fixes #4273
parent 3685c30f
......@@ -87,7 +87,7 @@
"path-to-regexp": "2.1.0",
"prop-types": "15.6.0",
"prop-types-exact": "1.1.1",
"react-hot-loader": "4.1.1",
"react-hot-loader": "4.1.2",
"recursive-copy": "2.0.6",
"resolve": "1.5.0",
"send": "0.16.1",
......
export default () => {
return (
<>' '<div className='hmr-style-page'>
<p>
This is the style page.
<style jsx>{`
p {
font-size: 100px;
}
`}</style>
</p>
</div>' '</>
)
}
......@@ -98,6 +98,41 @@ export default (context, render) => {
browser.close()
})
// Added because of a regression in react-hot-loader, see issues: #4246 #4273
// Also: https://github.com/zeit/styled-jsx/issues/425
it('should update styles correctly', async () => {
const browser = await webdriver(context.appPort, '/hmr/style')
const pTag = await browser.elementByCss('.hmr-style-page p')
const initialFontSize = await pTag.getComputedCss('font-size')
expect(initialFontSize).toBe('100px')
const pagePath = join(__dirname, '../', 'pages', 'hmr', 'style.js')
const originalContent = readFileSync(pagePath, 'utf8')
const editedContent = originalContent.replace('100px', '200px')
// Change the page
writeFileSync(pagePath, editedContent, 'utf8')
// wait for 5 seconds
await waitFor(5000)
try {
// Check whether the this page has reloaded or not.
const editedPTag = await browser.elementByCss('.hmr-style-page p')
const editedFontSize = await editedPTag.getComputedCss('font-size')
expect(editedFontSize).toBe('200px')
} finally {
// Finally is used so that we revert the content back to the original regardless of the test outcome
// restore the about page content.
writeFileSync(pagePath, originalContent, 'utf8')
}
browser.close()
})
})
})
}
......@@ -56,6 +56,7 @@ describe('Basic Features', () => {
renderViaHTTP(context.appPort, '/nested-cdm/index'),
renderViaHTTP(context.appPort, '/hmr/about'),
renderViaHTTP(context.appPort, '/hmr/style'),
renderViaHTTP(context.appPort, '/hmr/contact'),
renderViaHTTP(context.appPort, '/hmr/counter')
])
......
......@@ -6133,20 +6133,20 @@ react-dom@16.2.0:
object-assign "^4.1.1"
prop-types "^15.6.0"
react-hot-loader@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.1.1.tgz#693499a6414b6dc6880287e254322a9d3155e944"
react-hot-loader@4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.1.2.tgz#5e8025f5bc5605506586b46eb2c6cc4006fd54d7"
dependencies:
fast-levenshtein "^2.0.6"
global "^4.3.0"
hoist-non-react-statics "^2.5.0"
prop-types "^15.6.1"
react-lifecycles-compat "^2.0.0"
react-lifecycles-compat "^3.0.2"
shallowequal "^1.0.2"
react-lifecycles-compat@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-2.0.2.tgz#00a23160eec17a43b94dd74f95d44a1a2c3c5ec1"
react-lifecycles-compat@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.2.tgz#7279047275bd727a912e25f734c0559527e84eff"
react@16.2.0:
version "16.2.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment