summaryrefslogtreecommitdiff
path: root/spec/javascripts/sidebar
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2018-05-03 13:01:52 +0530
committerKushal Pandya <kushal@gitlab.com>2018-05-03 16:34:01 +0530
commitd2665707c04594a6cea22ebb3b4d89a0577d02c5 (patch)
tree2050b5c2e885ca9dcdbbf7e3b4774fd0f4c15309 /spec/javascripts/sidebar
parentb2e1b70927f94a50a83e5afef359775894bd6b03 (diff)
downloadgitlab-ce-d2665707c04594a6cea22ebb3b4d89a0577d02c5.tar.gz
Emit `toggleSubscription`, `toggleSidebar` events on component
Diffstat (limited to 'spec/javascripts/sidebar')
-rw-r--r--spec/javascripts/sidebar/subscriptions_spec.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/javascripts/sidebar/subscriptions_spec.js b/spec/javascripts/sidebar/subscriptions_spec.js
index aee8f0acbb9..f0a53e573c3 100644
--- a/spec/javascripts/sidebar/subscriptions_spec.js
+++ b/spec/javascripts/sidebar/subscriptions_spec.js
@@ -1,5 +1,6 @@
import Vue from 'vue';
import subscriptions from '~/sidebar/components/subscriptions/subscriptions.vue';
+import eventHub from '~/sidebar/event_hub';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
describe('Subscriptions', function () {
@@ -39,4 +40,22 @@ describe('Subscriptions', function () {
expect(vm.$refs.toggleButton.$el.querySelector('.project-feature-toggle')).toHaveClass('is-checked');
});
+
+ it('toggleSubscription method emits `toggleSubscription` event on eventHub and Component', () => {
+ vm = mountComponent(Subscriptions, { subscribed: true });
+ spyOn(eventHub, '$emit');
+ spyOn(vm, '$emit');
+
+ vm.toggleSubscription();
+ expect(eventHub.$emit).toHaveBeenCalledWith('toggleSubscription', jasmine.any(Object));
+ expect(vm.$emit).toHaveBeenCalledWith('toggleSubscription', jasmine.any(Object));
+ });
+
+ it('onClickCollapsedIcon method emits `toggleSidebar` event on component', () => {
+ vm = mountComponent(Subscriptions, { subscribed: true });
+ spyOn(vm, '$emit');
+
+ vm.onClickCollapsedIcon();
+ expect(vm.$emit).toHaveBeenCalledWith('toggleSidebar');
+ });
});