-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] allow users to use the browser-back button (#650)
* Rename index to home * Reorganize the routing * Remove superfluous page setting methods * Remove unnecessary getters from store * Must rename tests too * Mock routing in the next-page test * Add test for navbar * Ensure next-page button does not appear on download page Also remove some unnecessary cypress comands * Remove deprecated store methods from test No longer needed * Remove these files as well * Add browser-back test to e2e test
- Loading branch information
Showing
13 changed files
with
151 additions
and
229 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import toolNavbar from '~/components/tool-navbar.vue'; | ||
|
||
|
||
describe('Navbar Component', () => { | ||
beforeEach(() => { | ||
const $route = { name: 'home' }; | ||
const store = { | ||
state: { | ||
pageOrder: ['home', 'about', 'contact'] | ||
}, | ||
getters: { | ||
isPageAccessible: () => true | ||
}, | ||
dispatch: () => {} | ||
}; | ||
|
||
cy.spy(store, "dispatch").as("dispatchSpy"); | ||
|
||
cy.mount(toolNavbar, { | ||
mocks: { | ||
$route, | ||
$store: store | ||
} | ||
}); | ||
}); | ||
|
||
it('lists all nav items', () => { | ||
cy.get('[data-cy=menu-item-home]').should('exist'); | ||
cy.get('[data-cy=menu-item-about]').should('exist'); | ||
cy.get('[data-cy=menu-item-contact]').should('exist'); | ||
}); | ||
|
||
it('the current page rout is highlighted with a different css style', () => { | ||
cy.get('[data-cy=menu-item-home]').should('have.class', 'dark'); | ||
cy.get('[data-cy=menu-item-about]').should('not.have.class', 'dark'); | ||
cy.get('[data-cy=menu-item-contact]').should('not.have.class', 'dark'); | ||
}); | ||
|
||
it('navigates to a page on nav item click', () => { | ||
cy.get('[data-cy=menu-item-about]').click(); | ||
cy.get('@dispatchSpy').should('have.been.calledWith', 'navigateToPage', 'about'); | ||
}); | ||
}); |
Oops, something went wrong.