Consume toggleSubscription
event directly from Subscriptions component
This commit is contained in:
parent
de3194bf89
commit
aa0a35a867
2 changed files with 2 additions and 9 deletions
|
@ -1,6 +1,5 @@
|
|||
<script>
|
||||
import Store from '../../stores/sidebar_store';
|
||||
import eventHub from '../../event_hub';
|
||||
import Flash from '../../../flash';
|
||||
import { __ } from '../../../locale';
|
||||
import subscriptions from './subscriptions.vue';
|
||||
|
@ -20,12 +19,6 @@ export default {
|
|||
store: new Store(),
|
||||
};
|
||||
},
|
||||
created() {
|
||||
eventHub.$on('toggleSubscription', this.onToggleSubscription);
|
||||
},
|
||||
beforeDestroy() {
|
||||
eventHub.$off('toggleSubscription', this.onToggleSubscription);
|
||||
},
|
||||
methods: {
|
||||
onToggleSubscription() {
|
||||
this.mediator.toggleSubscription()
|
||||
|
@ -42,6 +35,7 @@ export default {
|
|||
<subscriptions
|
||||
:loading="store.isFetching.subscriptions"
|
||||
:subscribed="store.subscribed"
|
||||
@toggleSubscription="onToggleSubscription"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -3,7 +3,6 @@ import sidebarSubscriptions from '~/sidebar/components/subscriptions/sidebar_sub
|
|||
import SidebarMediator from '~/sidebar/sidebar_mediator';
|
||||
import SidebarService from '~/sidebar/services/sidebar_service';
|
||||
import SidebarStore from '~/sidebar/stores/sidebar_store';
|
||||
import eventHub from '~/sidebar/event_hub';
|
||||
import mountComponent from 'spec/helpers/vue_mount_component_helper';
|
||||
import Mock from './mock_data';
|
||||
|
||||
|
@ -32,7 +31,7 @@ describe('Sidebar Subscriptions', function () {
|
|||
mediator,
|
||||
});
|
||||
|
||||
eventHub.$emit('toggleSubscription');
|
||||
vm.onToggleSubscription();
|
||||
|
||||
expect(mediator.toggleSubscription).toHaveBeenCalled();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue