Stops triggering board sidebar when clicking avatar

This commit is contained in:
Phil Hughes 2017-03-27 19:07:44 +01:00
parent ad831ace7e
commit 6765a4e4d3
3 changed files with 23 additions and 6 deletions

View File

@ -50,9 +50,7 @@ export default {
this.showDetail = false;
},
showIssue(e) {
const targetTagName = e.target.tagName.toLowerCase();
if (targetTagName === 'a' || targetTagName === 'button') return;
if (e.target.classList.contains('js-no-trigger')) return;
if (this.showDetail) {
this.showDetail = false;

View File

@ -84,20 +84,20 @@ import eventHub from '../eventhub';
#{{ issue.id }}
</span>
<a
class="card-assignee has-tooltip"
class="card-assignee has-tooltip js-no-trigger"
:href="rootPath + issue.assignee.username"
:title="'Assigned to ' + issue.assignee.name"
v-if="issue.assignee"
data-container="body">
<img
class="avatar avatar-inline s20"
class="avatar avatar-inline s20 js-no-trigger"
:src="issue.assignee.avatar"
width="20"
height="20"
:alt="'Avatar for ' + issue.assignee.name" />
</a>
<button
class="label color-label has-tooltip"
class="label color-label has-tooltip js-no-trigger"
v-for="label in issue.labels"
type="button"
v-if="showLabel(label)"

View File

@ -1,10 +1,12 @@
/* global List */
/* global ListUser */
/* global ListLabel */
/* global listObj */
/* global boardsMockInterceptor */
/* global BoardService */
import Vue from 'vue';
import '~/boards/models/user';
require('~/boards/models/list');
require('~/boards/models/label');
@ -130,6 +132,23 @@ describe('Issue card', () => {
expect(gl.issueBoards.BoardsStore.detail.issue).toEqual({});
});
it('does not set detail issue if img is clicked', (done) => {
vm.issue.assignee = new ListUser({
id: 1,
name: 'testing 123',
username: 'test',
avatar: 'test_image',
});
Vue.nextTick(() => {
triggerEvent('mouseup', vm.$el.querySelector('img'));
expect(gl.issueBoards.BoardsStore.detail.issue).toEqual({});
done();
});
});
it('does not set detail issue if showDetail is false after mouseup', () => {
triggerEvent('mouseup');