-
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(router): add support for server-side data fetching with catch-all…
… routes (#602)
- Loading branch information
1 parent
cfda180
commit dd8922f
Showing
12 changed files
with
82 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
import * as app from '../support/app.po'; | ||
|
||
describe('My Store', () => { | ||
beforeEach(() => cy.visit('/')); | ||
|
||
it(`Given the user has navigated to the home page | ||
Then the app title is visible`, () => { | ||
cy.visit('/'); | ||
app.getTitle().contains(/my store/i); | ||
}); | ||
|
||
it(`Given the user has navigated an invalid page then the page not found title is visible`, () => { | ||
cy.visit('/bad'); | ||
app.get404Title().contains(/page not found/i); | ||
}); | ||
|
||
it(`Given the user has navigated an invalid nested page then the page not found title is visible`, () => { | ||
cy.visit('/shipping/bad'); | ||
app.getNested404Title().contains(/shipping page not found/i); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1 +1,6 @@ | ||
export const getTitle = () => cy.contains('h1', /my store/i); | ||
|
||
export const get404Title = () => cy.contains('h2', /page not found/i); | ||
|
||
export const getNested404Title = () => | ||
cy.contains('h2', /shipping page not found/i); |
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,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-page-not-found', | ||
standalone: true, | ||
template: ` <h2>Page Not Found</h2> `, | ||
}) | ||
export default class PageNotFoundComponent {} |
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,9 @@ | ||
import { PageServerLoad } from '@analogjs/router'; | ||
|
||
export function load({ params }: PageServerLoad) { | ||
console.log('params', params); | ||
|
||
return { | ||
loaded: true, | ||
}; | ||
} |
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,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-shipping-page-not-found', | ||
standalone: true, | ||
template: ` <h2>Shipping Page Not Found</h2> `, | ||
}) | ||
export default class ShippingPageNotFoundComponent {} |
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,9 @@ | ||
import { PageServerLoad } from '@analogjs/router'; | ||
|
||
export function load({ params }: PageServerLoad) { | ||
console.log('slug', params?.['slug']); | ||
|
||
return { | ||
loaded: true, | ||
}; | ||
} |
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 |
---|---|---|
@@ -1 +1,14 @@ | ||
[] | ||
[ | ||
{ | ||
"type": "Overnight", | ||
"price": 25.99 | ||
}, | ||
{ | ||
"type": "2-Day", | ||
"price": 9.99 | ||
}, | ||
{ | ||
"type": "Postal", | ||
"price": 2.99 | ||
} | ||
] |
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 |
---|---|---|
@@ -1 +1,9 @@ | ||
/// <reference types="vite/client" /> | ||
|
||
interface ImportMetaEnv { | ||
readonly VITE_ANALOG_PUBLIC_BASE_URL: string; | ||
} | ||
|
||
interface ImportMeta { | ||
readonly env: ImportMetaEnv; | ||
} |
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