Update RegExp test and remove extra script (#11006)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
This commit is contained in:
parent
8f8030f7eb
commit
9943334d44
6 changed files with 34 additions and 21 deletions
|
@ -3,5 +3,4 @@ node_modules
|
|||
**/_next/**
|
||||
**/dist/**
|
||||
examples/with-ioc/**
|
||||
examples/with-kea/**
|
||||
test/integration/production/public/**/*
|
||||
examples/with-kea/**
|
|
@ -1,5 +1,4 @@
|
|||
node_modules
|
||||
**/.next/**
|
||||
**/_next/**
|
||||
**/dist/**
|
||||
test/integration/production/public/**/*
|
||||
**/dist/**
|
|
@ -1,4 +1,3 @@
|
|||
**/.next/**
|
||||
**/_next/**
|
||||
**/dist/**
|
||||
test/integration/production/public/**/*
|
||||
**/dist/**
|
|
@ -1,12 +1,23 @@
|
|||
export default () => {
|
||||
import * as React from 'react'
|
||||
|
||||
const Home = () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.didRender = true
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
// If this script is loaded before the polyfills it will
|
||||
// still fail
|
||||
const el = document.createElement('script')
|
||||
el.src = '/regexp-test.js'
|
||||
document.querySelector('body').appendChild(el)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<p>hi</p>
|
||||
<script src="/regexp-test.js" />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Home
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -64,6 +64,12 @@ describe('Production Usage', () => {
|
|||
it('should polyfill RegExp successfully', async () => {
|
||||
const browser = await webdriver(appPort, '/regexp-polyfill')
|
||||
expect(await browser.eval('window.didRender')).toBe(true)
|
||||
// wait a second for the script to be loaded
|
||||
await waitFor(1000)
|
||||
|
||||
expect(await browser.eval('window.isSticky')).toBe(true)
|
||||
expect(await browser.eval('window.isMatch1')).toBe(true)
|
||||
expect(await browser.eval('window.isMatch2')).toBe(false)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue