Commit 8da4fff9 authored by Simon Knox's avatar Simon Knox

update some tests

parent 1ae579f8
......@@ -143,6 +143,27 @@ describe('Api', () => {
done();
});
});
it('creates a new group label', (done) => {
const namespace = 'some namespace';
const labelData = { some: 'data' };
const expectedUrl = `${dummyUrlRoot}/groups/${namespace}/labels`;
const expectedData = {
label: labelData,
};
spyOn(jQuery, 'ajax').and.callFake((request) => {
expect(request.url).toEqual(expectedUrl);
expect(request.dataType).toEqual('json');
expect(request.type).toEqual('POST');
expect(request.data).toEqual(expectedData);
return sendDummyResponse();
});
Api.newLabel(namespace, null, labelData, (response) => {
expect(response).toBe(dummyResponse);
done();
});
});
});
describe('groupProjects', () => {
......
......@@ -52,6 +52,7 @@ describe('Issue card component', () => {
issue,
issueLinkBase: '/test',
rootPath: '/',
groupId: null,
};
},
components: {
......@@ -61,6 +62,7 @@ describe('Issue card component', () => {
<issue-card
:issue="issue"
:list="list"
:group-id="groupId"
:issue-link-base="issueLinkBase"
:root-path="rootPath"></issue-card>
`,
......@@ -239,7 +241,6 @@ describe('Issue card component', () => {
});
describe('labels', () => {
describe('exists', () => {
beforeEach((done) => {
component.issue.addLabel(label1);
......@@ -292,12 +293,55 @@ describe('Issue card component', () => {
).toBe(2);
expect(
component.$el.textContent,
).not.toContain('closed');
).not.toContain('Closed');
done();
})
.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('.label').length,
).toBe(3);
expect(
component.$el.textContent,
).toContain('Group label');
done();
})
.catch(done.fail);
});
it('does not show 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('.label').length,
).toBe(2);
expect(
component.$el.textContent,
).not.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