forked from gatsbyjs/gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby): Fix client side routing match paths regression (gatsbyjs…
…#15010) * export loader.findMatchPath * reorganize production-app explicit navigate if statement * strip BASE_PATH prefix before finding matchPath * Add end to end tests * Remove screenshots * Update tests * Add .gitignore * Move tests to development runtime * Hard code path in tests * Remove serve e2e tests * Add tests in production runtime
- Loading branch information
Showing
8 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
e2e-tests/development-runtime/cypress/integration/functionality/paths.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,11 @@ | ||
describe(`develop`, () => { | ||
it(`works with the client side path`, () => { | ||
cy.visit(`/paths/app`).waitForRouteChange() | ||
cy.get(`h1`).contains(`App Page`) | ||
}) | ||
|
||
it(`works with a child of the client side path`, () => { | ||
cy.visit(`/paths/app/12345`).waitForRouteChange() | ||
cy.get(`h1`).contains(`Not Found in App`) | ||
}) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Router } from "@reach/router" | ||
import React from "react" | ||
|
||
const App = () => <h1>App Page</h1> | ||
|
||
const NotFound = () => <h1>Not Found in App</h1> | ||
|
||
const AppPage = () => ( | ||
<Router> | ||
<App path="/paths/app" /> | ||
<NotFound default /> | ||
</Router> | ||
) | ||
|
||
export default AppPage |
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,11 @@ | ||
describe(`serve`, () => { | ||
it(`works with the client side path`, () => { | ||
cy.visit(`/paths/app`).waitForRouteChange() | ||
cy.get(`h1`).contains(`App Page`) | ||
}) | ||
|
||
it(`works with a child of the client side path`, () => { | ||
cy.visit(`/paths/app/12345`).waitForRouteChange() | ||
cy.get(`h1`).contains(`Not Found in App`) | ||
}) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Router } from '@reach/router' | ||
import React from 'react' | ||
|
||
const App = () => <h1>App Page</h1> | ||
|
||
const NotFound = () => <h1>Not Found in App</h1> | ||
|
||
const AppPage = () => ( | ||
<Router> | ||
<App path="/paths/app" /> | ||
<NotFound default /> | ||
</Router> | ||
) | ||
|
||
export default AppPage |
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