-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/package
- Loading branch information
Showing
92 changed files
with
3,612 additions
and
4,035 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
e2e-tests/production-runtime/cypress/integration/modified-exports-ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Test that page templates have certain exports removed while other files are left alone. | ||
* | ||
* Page templates support only a default exported React component and named exports of | ||
* `config` and `getServerData`, so it's not necessary (or possible) to test other exports | ||
* in page templates. | ||
*/ | ||
|
||
const config = `config exported from a non-page template module` | ||
const getServerData = `getServerData exported from a non-page template module` | ||
const helloWorld = `hello world` | ||
|
||
describe(`modifed exports`, () => { | ||
beforeEach(() => { | ||
cy.visit(`/modified-exports-ts`).waitForRouteChange() | ||
}) | ||
|
||
describe(`page templates`, () => { | ||
it(`should have exports named config removed`, () => { | ||
cy.getTestElement(`modified-exports-page-template-config`) | ||
.invoke(`text`) | ||
.should(`contain`, `undefined`) | ||
}) | ||
it(`should have exports named getServerData removed`, () => { | ||
cy.getTestElement(`modified-exports-page-template-get-server-data`) | ||
.invoke(`text`) | ||
.should(`contain`, `undefined`) | ||
}) | ||
it(`should have imported exports named config left alone`, () => { | ||
cy.getTestElement(`unmodified-exports-page-template-config`) | ||
.invoke(`text`) | ||
.should(`contain`, config) | ||
}) | ||
it(`should have imported exports named getServerData left alone`, () => { | ||
cy.getTestElement(`unmodified-exports-page-template-get-server-data`) | ||
.invoke(`text`) | ||
.should(`contain`, getServerData) | ||
}) | ||
it(`should have other imported exports left alone`, () => { | ||
cy.getTestElement(`unmodified-exports-page-template-hello-world`) | ||
.invoke(`text`) | ||
.should(`contain`, helloWorld) | ||
}) | ||
}) | ||
|
||
describe(`other JS files`, () => { | ||
it(`should have exports named config left alone`, () => { | ||
cy.getTestElement(`unmodified-exports-config`) | ||
.invoke(`text`) | ||
.should(`contain`, config) | ||
}) | ||
|
||
it(`should have exports named getServerData left alone`, () => { | ||
cy.getTestElement(`unmodified-exports-get-server-data`) | ||
.invoke(`text`) | ||
.should(`contain`, getServerData) | ||
}) | ||
|
||
it(`should have other named exports left alone`, () => { | ||
cy.getTestElement(`unmodified-exports-hello-world`) | ||
.invoke(`text`) | ||
.should(`contain`, helloWorld) | ||
}) | ||
}) | ||
}) |
39 changes: 39 additions & 0 deletions
39
e2e-tests/production-runtime/src/pages/modified-exports-ts.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from "react" | ||
import UnmodifiedExports, { | ||
config as importedConfig, | ||
getServerData as importedGetServerData, | ||
helloWorld, | ||
} from "../components/unmodified-exports" | ||
|
||
function ModifiedExports() { | ||
return ( | ||
<div> | ||
<p>This is the modified exports for page templates test page</p> | ||
{/* Use typeof to avoid runtime error */} | ||
<p data-testid="modified-exports-page-template-config">{typeof config}</p> | ||
<p data-testid="modified-exports-page-template-get-server-data"> | ||
{typeof getServerData} | ||
</p> | ||
<p data-testid="unmodified-exports-page-template-config"> | ||
{importedConfig()} | ||
</p> | ||
<p data-testid="unmodified-exports-page-template-get-server-data"> | ||
{importedGetServerData()} | ||
</p> | ||
<p data-testid="unmodified-exports-page-template-hello-world"> | ||
{helloWorld()} | ||
</p> | ||
<UnmodifiedExports /> | ||
</div> | ||
) | ||
} | ||
|
||
export function config() { | ||
return () => "config exported from a page template module" // Expects config to be a function factory | ||
} | ||
|
||
export function getServerData() { | ||
return "getServerData exported from a page template module" | ||
} | ||
|
||
export default ModifiedExports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.