Commit 18fa27d9 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'winh-issue_card_spec-ee' into 'master'

Remove EE-specic parts from issue_card_spec.js

Closes #10503

See merge request gitlab-org/gitlab-ee!10620
parents bd230fb2 dc00a280
/* global ListLabel */
/* global ListIssue */
import Vue from 'vue';
import _ from 'underscore';
import '~/vue_shared/models/label';
import '~/vue_shared/models/assignee';
import '~/boards/models/issue';
import '~/boards/models/list';
import IssueCardInner from '~/boards/components/issue_card_inner.vue';
import ListIssue from 'ee/boards/models/issue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { listObj } from 'spec/boards/mock_data';
describe('Issue card component', () => {
let vm;
const Component = Vue.extend(IssueCardInner);
const list = listObj;
const issue = new ListIssue({
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [list.label],
assignees: [],
const label1 = new ListLabel({
id: 3,
title: 'testing 123',
color: 'blue',
text_color: 'white',
description: 'test',
});
let component;
let issue;
let list;
afterEach(() => {
vm.$destroy();
});
beforeEach(() => {
setFixtures('<div class="test-container"></div>');
it('does not render issue weight if none specified', () => {
vm = mountComponent(Component, {
list,
issue,
issueLinkBase: '/test',
rootPath: '/',
groupId: null,
list = listObj;
issue = new ListIssue({
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [list.label],
assignees: [],
reference_path: '#1',
real_path: '/test/1',
});
expect(vm.$el.querySelector('.board-card-weight')).toBeNull();
component = new Vue({
el: document.querySelector('.test-container'),
components: {
'issue-card': IssueCardInner,
},
data() {
return {
list,
issue,
issueLinkBase: '/test',
rootPath: '/',
groupId: null,
};
},
template: `
<issue-card
:issue="issue"
:list="list"
:group-id="groupId"
:issue-link-base="issueLinkBase"
:root-path="rootPath"></issue-card>
`,
});
});
it('renders issue weight if specified', () => {
vm = mountComponent(Component, {
list,
issue: {
...issue,
weight: 2,
},
issueLinkBase: '/test',
rootPath: '/',
groupId: null,
describe('labels', () => {
beforeEach(done => {
component.issue.addLabel(label1);
Vue.nextTick(() => done());
});
const el = vm.$el.querySelector('.board-card-weight');
expect(el).not.toBeNull();
expect(el.textContent.trim()).toContain('2');
it('shows group labels on group boards', done => {
component.issue.addLabel(
new ListLabel({
id: _.random(10000),
title: 'Group label',
type: 'GroupLabel',
}),
);
component.groupId = 1;
Vue.nextTick()
.then(() => {
expect(component.$el.querySelectorAll('.badge').length).toBe(3);
expect(component.$el.textContent).toContain('Group label');
done();
})
.catch(done.fail);
});
it('shows project labels on group boards', done => {
component.issue.addLabel(
new ListLabel({
id: 123,
title: 'Project label',
type: 'ProjectLabel',
}),
);
component.groupId = 1;
Vue.nextTick()
.then(() => {
expect(component.$el.querySelectorAll('.badge').length).toBe(3);
expect(component.$el.textContent).toContain('Project label');
done();
})
.catch(done.fail);
});
});
});
......@@ -3,7 +3,6 @@
/* global ListIssue */
import Vue from 'vue';
import _ from 'underscore';
import '~/vue_shared/models/label';
import '~/vue_shared/models/assignee';
......@@ -56,14 +55,12 @@ describe('Issue card component', () => {
issue,
issueLinkBase: '/test',
rootPath: '/',
groupId: null,
};
},
template: `
<issue-card
:issue="issue"
:list="list"
:group-id="groupId"
:issue-link-base="issueLinkBase"
:root-path="rootPath"></issue-card>
`,
......@@ -287,47 +284,5 @@ describe('Issue card component', () => {
})
.catch(done.fail);
});
it('shows group labels on group boards', done => {
component.issue.addLabel(
new ListLabel({
id: _.random(10000),
title: 'Group label',
type: 'GroupLabel',
}),
);
component.groupId = 1;
Vue.nextTick()
.then(() => {
expect(component.$el.querySelectorAll('.badge').length).toBe(3);
expect(component.$el.textContent).toContain('Group label');
done();
})
.catch(done.fail);
});
it('shows project labels on group boards', done => {
component.issue.addLabel(
new ListLabel({
id: 123,
title: 'Project label',
type: 'ProjectLabel',
}),
);
component.groupId = 1;
Vue.nextTick()
.then(() => {
expect(component.$el.querySelectorAll('.badge').length).toBe(3);
expect(component.$el.textContent).toContain('Project label');
done();
})
.catch(done.fail);
});
});
});
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