-
Notifications
You must be signed in to change notification settings - Fork 920
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
211 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
foo: HMR foo | ||
--- | ||
|
||
## link to title | ||
|
||
[title](./title.md) | ||
|
||
## rendered foo | ||
|
||
{{ $frontmatter.foo }} |
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 @@ | ||
# HMR Title | ||
|
||
## link to frontmatter | ||
|
||
[frontmatter](./frontmatter.md) | ||
|
||
## rendered title | ||
|
||
{{ $page.title }} |
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,24 @@ | ||
if (Cypress.env('E2E_COMMAND') === 'dev') { | ||
it('should update frontmatter correctly', () => { | ||
cy.visit('/hmr/frontmatter.html') | ||
cy.get('.e2e-theme-content #rendered-foo + p').should( | ||
'have.text', | ||
'HMR foo', | ||
) | ||
|
||
cy.task('hmr:frontmatter') | ||
.then(() => { | ||
cy.get('.e2e-theme-content #rendered-foo + p').should( | ||
'have.text', | ||
'Updated foo', | ||
) | ||
}) | ||
.then(() => cy.task('hmr:frontmatter:restore')) | ||
.then(() => { | ||
cy.get('.e2e-theme-content #rendered-foo + p').should( | ||
'have.text', | ||
'HMR foo', | ||
) | ||
}) | ||
}) | ||
} |
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,85 @@ | ||
if (Cypress.env('E2E_COMMAND') === 'dev') { | ||
it('should update title and frontmatter correctly after navigation', () => { | ||
cy.visit('/hmr/title.html') | ||
cy.title().should('include', 'HMR Title') | ||
cy.get('.e2e-theme-content #rendered-title + p').should( | ||
'have.text', | ||
'HMR Title', | ||
) | ||
|
||
// update title page | ||
cy.task('hmr:title') | ||
.then(() => { | ||
cy.title().should('include', 'Updated Title') | ||
cy.get('.e2e-theme-content #rendered-title + p').should( | ||
'have.text', | ||
'Updated Title', | ||
) | ||
}) | ||
// navigate to frontmatter page | ||
.then(() => { | ||
cy.get('.e2e-theme-content #link-to-frontmatter + p > a').click() | ||
cy.get('.e2e-theme-content #rendered-foo + p').should( | ||
'have.text', | ||
'HMR foo', | ||
) | ||
}) | ||
// update frontmatter page | ||
.then(() => cy.task('hmr:frontmatter')) | ||
.then(() => { | ||
cy.get('.e2e-theme-content #rendered-foo + p').should( | ||
'have.text', | ||
'Updated foo', | ||
) | ||
}) | ||
// navigate to title page | ||
.then(() => { | ||
cy.get('.e2e-theme-content #link-to-title + p > a').click() | ||
cy.get('.e2e-theme-content #rendered-title + p').should( | ||
'have.text', | ||
'Updated Title', | ||
) | ||
}) | ||
// restore title page | ||
.then(() => cy.task('hmr:title:restore')) | ||
.then(() => { | ||
cy.title().should('include', 'HMR Title') | ||
cy.get('.e2e-theme-content #rendered-title + p').should( | ||
'have.text', | ||
'HMR Title', | ||
) | ||
}) | ||
// navigate to frontmatter page | ||
.then(() => { | ||
cy.get('.e2e-theme-content #link-to-frontmatter + p > a').click() | ||
cy.get('.e2e-theme-content #rendered-foo + p').should( | ||
'have.text', | ||
'Updated foo', | ||
) | ||
}) | ||
// restore frontmatter page | ||
.then(() => cy.task('hmr:frontmatter:restore')) | ||
.then(() => { | ||
cy.get('.e2e-theme-content #rendered-foo + p').should( | ||
'have.text', | ||
'HMR foo', | ||
) | ||
}) | ||
// navigate to title page | ||
.then(() => { | ||
cy.get('.e2e-theme-content #link-to-title + p > a').click() | ||
cy.get('.e2e-theme-content #rendered-title + p').should( | ||
'have.text', | ||
'HMR Title', | ||
) | ||
}) | ||
// navigate to frontmatter page | ||
.then(() => { | ||
cy.get('.e2e-theme-content #link-to-frontmatter + p > a').click() | ||
cy.get('.e2e-theme-content #rendered-foo + p').should( | ||
'have.text', | ||
'HMR foo', | ||
) | ||
}) | ||
}) | ||
} |
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,27 @@ | ||
if (Cypress.env('E2E_COMMAND') === 'dev') { | ||
it('should update title correctly', () => { | ||
cy.visit('/hmr/title.html') | ||
cy.title().should('include', 'HMR Title') | ||
cy.get('.e2e-theme-content #rendered-title + p').should( | ||
'have.text', | ||
'HMR Title', | ||
) | ||
|
||
cy.task('hmr:title') | ||
.then(() => { | ||
cy.title().should('include', 'Updated Title') | ||
cy.get('.e2e-theme-content #rendered-title + p').should( | ||
'have.text', | ||
'Updated Title', | ||
) | ||
}) | ||
.then(() => cy.task('hmr:title:restore')) | ||
.then(() => { | ||
cy.title().should('include', 'HMR Title') | ||
cy.get('.e2e-theme-content #rendered-title + p').should( | ||
'have.text', | ||
'HMR Title', | ||
) | ||
}) | ||
}) | ||
} |