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

Update RegExp test and remove extra script #11006

Merged
merged 3 commits into from Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintignore
Expand Up @@ -3,5 +3,4 @@ node_modules
**/_next/**
**/dist/**
examples/with-ioc/**
examples/with-kea/**
test/integration/production/public/**/*
examples/with-kea/**
3 changes: 1 addition & 2 deletions .prettierignore
@@ -1,5 +1,4 @@
node_modules
**/.next/**
**/_next/**
**/dist/**
test/integration/production/public/**/*
**/dist/**
3 changes: 1 addition & 2 deletions .prettierignore_staged
@@ -1,4 +1,3 @@
**/.next/**
**/_next/**
**/dist/**
test/integration/production/public/**/*
**/dist/**
15 changes: 13 additions & 2 deletions test/integration/production/pages/regexp-polyfill.js
@@ -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
25 changes: 12 additions & 13 deletions test/integration/production/public/regexp-test.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions test/integration/production/test/index.test.js
Expand Up @@ -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)
})
}

Expand Down