Commit dd95549c authored by Scott Stern's avatar Scott Stern Committed by Simon Knox

Resolve sidebar opening on click of label

parent 5e025655
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
...mapActions(['toggleBoardItemMultiSelection', 'toggleBoardItem']), ...mapActions(['toggleBoardItemMultiSelection', 'toggleBoardItem']),
toggleIssue(e) { toggleIssue(e) {
// Don't do anything if this happened on a no trigger element // Don't do anything if this happened on a no trigger element
if (e.target.classList.contains('js-no-trigger')) return; if (e.target.closest('.js-no-trigger')) return;
const isMultiSelect = e.ctrlKey || e.metaKey; const isMultiSelect = e.ctrlKey || e.metaKey;
if (isMultiSelect) { if (isMultiSelect) {
......
...@@ -190,6 +190,7 @@ export default { ...@@ -190,6 +190,7 @@ export default {
<template v-for="label in orderedLabels"> <template v-for="label in orderedLabels">
<gl-label <gl-label
:key="label.id" :key="label.id"
class="js-no-trigger"
:background-color="label.color" :background-color="label.color"
:title="label.title" :title="label.title"
:description="label.description" :description="label.description"
......
---
title: Fix bug when board card label is clicked
merge_request: 60327
author:
type: fixed
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { GlLabel } from '@gitlab/ui';
import { createLocalVue, shallowMount, mount } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import BoardCard from '~/boards/components/board_card.vue'; import BoardCard from '~/boards/components/board_card.vue';
...@@ -18,6 +19,7 @@ describe('Board card', () => { ...@@ -18,6 +19,7 @@ describe('Board card', () => {
mockActions = { mockActions = {
toggleBoardItem: jest.fn(), toggleBoardItem: jest.fn(),
toggleBoardItemMultiSelection: jest.fn(), toggleBoardItemMultiSelection: jest.fn(),
performSearch: jest.fn(),
}; };
store = new Vuex.Store({ store = new Vuex.Store({
...@@ -35,12 +37,15 @@ describe('Board card', () => { ...@@ -35,12 +37,15 @@ describe('Board card', () => {
}; };
// this particular mount component needs to be used after the root beforeEach because it depends on list being initialized // this particular mount component needs to be used after the root beforeEach because it depends on list being initialized
const mountComponent = ({ propsData = {}, provide = {} } = {}) => { const mountComponent = ({
wrapper = shallowMount(BoardCard, { propsData = {},
provide = {},
mountFn = shallowMount,
stubs = { BoardCardInner },
} = {}) => {
wrapper = mountFn(BoardCard, {
localVue, localVue,
stubs: { stubs,
BoardCardInner,
},
store, store,
propsData: { propsData: {
list: mockLabelList, list: mockLabelList,
...@@ -74,6 +79,17 @@ describe('Board card', () => { ...@@ -74,6 +79,17 @@ describe('Board card', () => {
store = null; store = null;
}); });
describe('when GlLabel is clicked in BoardCardInner', () => {
it('doesnt call toggleBoardItem', () => {
createStore({ initialState: { isShowingLabels: true } });
mountComponent({ mountFn: mount, stubs: {} });
wrapper.find(GlLabel).trigger('mouseup');
expect(mockActions.toggleBoardItem).toHaveBeenCalledTimes(0);
});
});
describe.each` describe.each`
isSwimlanesOn isSwimlanesOn
${true} | ${false} ${true} | ${false}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment