Skip to content

Commit

Permalink
fix(NcAppNavigationItem): adjust tests to cover active prop
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
  • Loading branch information
raimund-schluessler committed Dec 23, 2023
1 parent ddf05e0 commit dc41791
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 22 additions & 1 deletion cypress/visual/AppNavigationItem.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import NcAppNavigationItem from '../../src/components/NcAppNavigationItem/NcAppN
describe('NcAppNavigationItem', () => {
describe('With router link', () => {
const RouterComponent = defineComponent({
template: '<div style="width: 300px; background: white;"><NcAppNavigationItem name="Home" to="/" :editable="true" /><NcAppNavigationItem name="Foo" to="/foo" :editable="true" /></div>',
template: `
<div style="width: 300px; background: white;">
<NcAppNavigationItem name="Home" to="/" :editable="true" />
<NcAppNavigationItem name="Foo" to="/foo" :editable="true" />
<NcAppNavigationItem name="Back" active :editable="true" />
<NcAppNavigationItem name="Bar" :editable="true" />
</div>`,
components: { NcAppNavigationItem },
})

Expand Down Expand Up @@ -41,5 +47,20 @@ describe('NcAppNavigationItem', () => {
cy.contains('.app-navigation-entry', 'Home').find('.app-navigation-entry__actions').click()
cy.get('.app-navigation-entry--editing').compareSnapshot('NcAppNavigationItem-primary-on-active-route-menu-active')
})

// Entries without router

it('has tertiary styling on non active entry', () => {
cy.contains('.app-navigation-entry', 'Bar').compareSnapshot('NcAppNavigationItem-tertiary-non-active-entry')
})

it('has primary styling on active entry', () => {
cy.contains('.app-navigation-entry', 'Back').compareSnapshot('NcAppNavigationItem-primary-on-active-entry')
})

it('has primary button styling on active entry with editing=true', () => {
cy.contains('.app-navigation-entry', 'Back').find('.app-navigation-entry__actions').click()
cy.get('.app-navigation-entry--editing').compareSnapshot('NcAppNavigationItem-primary-on-active-entry-menu-active')
})
})
})

0 comments on commit dc41791

Please sign in to comment.