-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #317 from chrismayer/force-sidebar-open-state
Extend 'sidebar-toggle' event to force open state
- Loading branch information
Showing
2 changed files
with
47 additions
and
6 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,36 @@ | ||
import AppSidebar from 'APP/components/AppSidebar'; | ||
import { WguEventBus } from '@/WguEventBus'; | ||
import { shallowMount } from '@vue/test-utils'; | ||
|
||
describe('AppSidebar.vue', () => { | ||
describe('data', () => { | ||
let comp; | ||
let vm; | ||
beforeEach(() => { | ||
comp = shallowMount(AppSidebar); | ||
vm = comp.vm; | ||
}); | ||
|
||
it('has correct default data', () => { | ||
expect(vm.sidebarOpen).to.equal(true); | ||
}); | ||
}); | ||
|
||
describe('events', () => { | ||
let comp; | ||
let vm; | ||
beforeEach(() => { | ||
comp = shallowMount(AppSidebar); | ||
vm = comp.vm; | ||
}); | ||
|
||
it('event "sidebar-toggle" forces correct open state', () => { | ||
// force closing sidebar by adding 'false' parameter | ||
WguEventBus.$emit('sidebar-toggle', false); | ||
expect(vm.sidebarOpen).to.equal(false); | ||
// toggle sidebar open state by skipping parameter | ||
WguEventBus.$emit('sidebar-toggle'); | ||
expect(vm.sidebarOpen).to.equal(true); | ||
}); | ||
}); | ||
}); |