Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

refactor: activate the plugin menu item when navigating to plugin route #1830

Merged
merged 3 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions __tests__/unit/components/App/AppSidemenu/AppSidemenu.spec.js
Expand Up @@ -113,11 +113,19 @@ describe('AppSidemenu', () => {
expect(wrapper.vm.isImportantNotificationVisible).toBe(false)
})

it('should toggle & close plugin menu state', () => {
expect(wrapper.vm.isPluginMenuVisible).toBe(false)
wrapper.vm.toggleShowPluginMenu()
expect(wrapper.vm.isPluginMenuVisible).toBe(true)
wrapper.vm.closeShowPlugins()
expect(wrapper.vm.isPluginMenuVisible).toBe(false)
describe('Plugin Menu', () => {
it('should toggle & close plugin menu state', () => {
expect(wrapper.vm.isPluginMenuVisible).toBe(false)
wrapper.vm.toggleShowPluginMenu()
expect(wrapper.vm.isPluginMenuVisible).toBe(true)
wrapper.vm.closeShowPlugins()
expect(wrapper.vm.isPluginMenuVisible).toBe(false)
})

it('should activate the plugin menu item when \'setActive\' is true', () => {
expect(wrapper.vm.activeItem).toBe('mock_route')
wrapper.vm.closeShowPlugins(true)
expect(wrapper.vm.activeItem).toBe('plugin-pages')
})
})
})
6 changes: 5 additions & 1 deletion src/renderer/components/App/AppSidemenu/AppSidemenu.vue
Expand Up @@ -224,7 +224,11 @@ export default {
this.isPluginMenuVisible = !this.isPluginMenuVisible
},

closeShowPlugins () {
closeShowPlugins (setActive) {
if (setActive) {
this.setActive('plugin-pages')
}

this.isPluginMenuVisible = false
}
}
Expand Down
Expand Up @@ -57,7 +57,7 @@ export default {

methods: {
navigateToRoute (routeName) {
this.$emit('close')
this.$emit('close', true)
this.$router.push({ name: routeName })
},

Expand Down