Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/boards')
-rw-r--r--spec/javascripts/boards/board_blank_state_spec.js64
-rw-r--r--spec/javascripts/boards/board_card_spec.js43
-rw-r--r--spec/javascripts/boards/board_new_issue_spec.js24
-rw-r--r--spec/javascripts/boards/boards_store_spec.js31
-rw-r--r--spec/javascripts/boards/issue_spec.js38
-rw-r--r--spec/javascripts/boards/list_spec.js90
6 files changed, 166 insertions, 124 deletions
diff --git a/spec/javascripts/boards/board_blank_state_spec.js b/spec/javascripts/boards/board_blank_state_spec.js
index 50505b41313..8e2a947b0dd 100644
--- a/spec/javascripts/boards/board_blank_state_spec.js
+++ b/spec/javascripts/boards/board_blank_state_spec.js
@@ -7,29 +7,35 @@ describe('Boards blank state', () => {
let vm;
let fail = false;
- beforeEach((done) => {
+ beforeEach(done => {
const Comp = Vue.extend(BoardBlankState);
boardsStore.create();
gl.boardService = mockBoardService();
- spyOn(gl.boardService, 'generateDefaultLists').and.callFake(() => new Promise((resolve, reject) => {
- if (fail) {
- reject();
- } else {
- resolve({
- data: [{
- id: 1,
- title: 'To Do',
- label: { id: 1 },
- }, {
- id: 2,
- title: 'Doing',
- label: { id: 2 },
- }],
- });
- }
- }));
+ spyOn(gl.boardService, 'generateDefaultLists').and.callFake(
+ () =>
+ new Promise((resolve, reject) => {
+ if (fail) {
+ reject();
+ } else {
+ resolve({
+ data: [
+ {
+ id: 1,
+ title: 'To Do',
+ label: { id: 1 },
+ },
+ {
+ id: 2,
+ title: 'Doing',
+ label: { id: 2 },
+ },
+ ],
+ });
+ }
+ }),
+ );
vm = new Comp();
@@ -40,20 +46,18 @@ describe('Boards blank state', () => {
});
it('renders pre-defined labels', () => {
- expect(
- vm.$el.querySelectorAll('.board-blank-state-list li').length,
- ).toBe(2);
+ expect(vm.$el.querySelectorAll('.board-blank-state-list li').length).toBe(2);
- expect(
- vm.$el.querySelectorAll('.board-blank-state-list li')[0].textContent.trim(),
- ).toEqual('To Do');
+ expect(vm.$el.querySelectorAll('.board-blank-state-list li')[0].textContent.trim()).toEqual(
+ 'To Do',
+ );
- expect(
- vm.$el.querySelectorAll('.board-blank-state-list li')[1].textContent.trim(),
- ).toEqual('Doing');
+ expect(vm.$el.querySelectorAll('.board-blank-state-list li')[1].textContent.trim()).toEqual(
+ 'Doing',
+ );
});
- it('clears blank state', (done) => {
+ it('clears blank state', done => {
vm.$el.querySelector('.btn-default').click();
setTimeout(() => {
@@ -63,7 +67,7 @@ describe('Boards blank state', () => {
});
});
- it('creates pre-defined labels', (done) => {
+ it('creates pre-defined labels', done => {
vm.$el.querySelector('.btn-success').click();
setTimeout(() => {
@@ -75,7 +79,7 @@ describe('Boards blank state', () => {
});
});
- it('resets the store if request fails', (done) => {
+ it('resets the store if request fails', done => {
fail = true;
vm.$el.querySelector('.btn-success').click();
diff --git a/spec/javascripts/boards/board_card_spec.js b/spec/javascripts/boards/board_card_spec.js
index 20cfe426807..e1017130bed 100644
--- a/spec/javascripts/boards/board_card_spec.js
+++ b/spec/javascripts/boards/board_card_spec.js
@@ -18,7 +18,7 @@ describe('Board card', () => {
let vm;
let mock;
- beforeEach((done) => {
+ beforeEach(done => {
mock = new MockAdapter(axios);
mock.onAny().reply(boardsMockInterceptor);
@@ -71,7 +71,7 @@ describe('Board card', () => {
expect(vm.$el.classList.contains('user-can-drag')).toBe(true);
});
- it('does not add user-can-drag class disabled', (done) => {
+ it('does not add user-can-drag class disabled', done => {
vm.disabled = true;
setTimeout(() => {
@@ -84,7 +84,7 @@ describe('Board card', () => {
expect(vm.$el.classList.contains('is-disabled')).toBe(false);
});
- it('adds disabled class is disabled is true', (done) => {
+ it('adds disabled class is disabled is true', done => {
vm.disabled = true;
setTimeout(() => {
@@ -96,8 +96,23 @@ describe('Board card', () => {
describe('mouse events', () => {
const triggerEvent = (eventName, el = vm.$el) => {
const event = document.createEvent('MouseEvents');
- event.initMouseEvent(eventName, true, true, window, 1, 0, 0, 0, 0, false, false,
- false, false, 0, null);
+ event.initMouseEvent(
+ eventName,
+ true,
+ true,
+ window,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ false,
+ false,
+ false,
+ false,
+ 0,
+ null,
+ );
el.dispatchEvent(event);
};
@@ -134,13 +149,15 @@ describe('Board card', () => {
expect(boardsStore.detail.issue).toEqual({});
});
- it('does not set detail issue if img is clicked', (done) => {
- vm.issue.assignees = [new ListAssignee({
- id: 1,
- name: 'testing 123',
- username: 'test',
- avatar: 'test_image',
- })];
+ it('does not set detail issue if img is clicked', done => {
+ vm.issue.assignees = [
+ new ListAssignee({
+ id: 1,
+ name: 'testing 123',
+ username: 'test',
+ avatar: 'test_image',
+ }),
+ ];
Vue.nextTick(() => {
triggerEvent('mouseup', vm.$el.querySelector('img'));
@@ -167,7 +184,7 @@ describe('Board card', () => {
expect(boardsStore.detail.list).toEqual(vm.list);
});
- it('adds active class if detail issue is set', (done) => {
+ it('adds active class if detail issue is set', done => {
vm.detailIssue.issue = vm.issue;
Vue.nextTick()
diff --git a/spec/javascripts/boards/board_new_issue_spec.js b/spec/javascripts/boards/board_new_issue_spec.js
index 9fea625a4ac..721d0b8172d 100644
--- a/spec/javascripts/boards/board_new_issue_spec.js
+++ b/spec/javascripts/boards/board_new_issue_spec.js
@@ -28,7 +28,7 @@ describe('Issue boards new issue form', () => {
return vm.submit(dummySubmitEvent);
};
- beforeEach((done) => {
+ beforeEach(done => {
setFixtures('<div class="test-container"></div>');
const BoardNewIssueComp = Vue.extend(boardNewIssue);
@@ -60,7 +60,7 @@ describe('Issue boards new issue form', () => {
mock.restore();
});
- it('calls submit if submit button is clicked', (done) => {
+ it('calls submit if submit button is clicked', done => {
spyOn(vm, 'submit').and.callFake(e => e.preventDefault());
vm.title = 'Testing Title';
@@ -78,7 +78,7 @@ describe('Issue boards new issue form', () => {
expect(vm.$el.querySelector('.btn-success').disabled).toBe(true);
});
- it('enables submit button if title is not empty', (done) => {
+ it('enables submit button if title is not empty', done => {
vm.title = 'Testing Title';
Vue.nextTick()
@@ -90,7 +90,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
- it('clears title after clicking cancel', (done) => {
+ it('clears title after clicking cancel', done => {
vm.$el.querySelector('.btn-default').click();
Vue.nextTick()
@@ -101,7 +101,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
- it('does not create new issue if title is empty', (done) => {
+ it('does not create new issue if title is empty', done => {
submitIssue()
.then(() => {
expect(list.newIssue).not.toHaveBeenCalled();
@@ -111,7 +111,7 @@ describe('Issue boards new issue form', () => {
});
describe('submit success', () => {
- it('creates new issue', (done) => {
+ it('creates new issue', done => {
vm.title = 'submit title';
Vue.nextTick()
@@ -123,7 +123,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
- it('enables button after submit', (done) => {
+ it('enables button after submit', done => {
vm.title = 'submit issue';
Vue.nextTick()
@@ -135,7 +135,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
- it('clears title after submit', (done) => {
+ it('clears title after submit', done => {
vm.title = 'submit issue';
Vue.nextTick()
@@ -147,7 +147,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
- it('sets detail issue after submit', (done) => {
+ it('sets detail issue after submit', done => {
expect(boardsStore.detail.issue.title).toBe(undefined);
vm.title = 'submit issue';
@@ -160,7 +160,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
- it('sets detail list after submit', (done) => {
+ it('sets detail list after submit', done => {
vm.title = 'submit issue';
Vue.nextTick()
@@ -179,7 +179,7 @@ describe('Issue boards new issue form', () => {
vm.title = 'error';
});
- it('removes issue', (done) => {
+ it('removes issue', done => {
Vue.nextTick()
.then(submitIssue)
.then(() => {
@@ -189,7 +189,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
- it('shows error', (done) => {
+ it('shows error', done => {
Vue.nextTick()
.then(submitIssue)
.then(() => {
diff --git a/spec/javascripts/boards/boards_store_spec.js b/spec/javascripts/boards/boards_store_spec.js
index 3b10550ba63..54f1edfb1f9 100644
--- a/spec/javascripts/boards/boards_store_spec.js
+++ b/spec/javascripts/boards/boards_store_spec.js
@@ -23,13 +23,16 @@ describe('Store', () => {
gl.boardService = mockBoardService();
boardsStore.create();
- spyOn(gl.boardService, 'moveIssue').and.callFake(() => new Promise((resolve) => {
- resolve();
- }));
+ spyOn(gl.boardService, 'moveIssue').and.callFake(
+ () =>
+ new Promise(resolve => {
+ resolve();
+ }),
+ );
Cookies.set('issue_board_welcome_hidden', 'false', {
expires: 365 * 10,
- path: ''
+ path: '',
});
});
@@ -62,7 +65,7 @@ describe('Store', () => {
expect(list).toBeDefined();
});
- it('gets issue when new list added', (done) => {
+ it('gets issue when new list added', done => {
boardsStore.addList(listObj);
const list = boardsStore.findList('id', listObj.id);
@@ -75,7 +78,7 @@ describe('Store', () => {
}, 0);
});
- it('persists new list', (done) => {
+ it('persists new list', done => {
boardsStore.new({
title: 'Test',
list_type: 'label',
@@ -83,8 +86,8 @@ describe('Store', () => {
id: 1,
title: 'Testing',
color: 'red',
- description: 'testing;'
- }
+ description: 'testing;',
+ },
});
expect(boardsStore.state.lists.length).toBe(1);
@@ -111,7 +114,7 @@ describe('Store', () => {
it('check for blank state adding when closed list exist', () => {
boardsStore.addList({
- list_type: 'closed'
+ list_type: 'closed',
});
expect(boardsStore.shouldAddBlankState()).toBe(true);
@@ -146,7 +149,7 @@ describe('Store', () => {
expect(listOne.position).toBe(1);
});
- it('moves an issue from one list to another', (done) => {
+ it('moves an issue from one list to another', done => {
const listOne = boardsStore.addList(listObj);
const listTwo = boardsStore.addList(listObjDuplicate);
@@ -165,7 +168,7 @@ describe('Store', () => {
}, 0);
});
- it('moves an issue from backlog to a list', (done) => {
+ it('moves an issue from backlog to a list', done => {
const backlog = boardsStore.addList({
...listObj,
list_type: 'backlog',
@@ -187,7 +190,7 @@ describe('Store', () => {
}, 0);
});
- it('moves issue to top of another list', (done) => {
+ it('moves issue to top of another list', done => {
const listOne = boardsStore.addList(listObj);
const listTwo = boardsStore.addList(listObjDuplicate);
@@ -210,7 +213,7 @@ describe('Store', () => {
}, 0);
});
- it('moves issue to bottom of another list', (done) => {
+ it('moves issue to bottom of another list', done => {
const listOne = boardsStore.addList(listObj);
const listTwo = boardsStore.addList(listObjDuplicate);
@@ -233,7 +236,7 @@ describe('Store', () => {
}, 0);
});
- it('moves issue in list', (done) => {
+ it('moves issue in list', done => {
const issue = new ListIssue({
title: 'Testing',
id: 2,
diff --git a/spec/javascripts/boards/issue_spec.js b/spec/javascripts/boards/issue_spec.js
index b3d215b7b25..437ab4bb3df 100644
--- a/spec/javascripts/boards/issue_spec.js
+++ b/spec/javascripts/boards/issue_spec.js
@@ -21,18 +21,22 @@ describe('Issue model', () => {
id: 1,
iid: 1,
confidential: false,
- labels: [{
- id: 1,
- title: 'test',
- color: 'red',
- description: 'testing'
- }],
- assignees: [{
- id: 1,
- name: 'name',
- username: 'username',
- avatar_url: 'http://avatar_url',
- }],
+ labels: [
+ {
+ id: 1,
+ title: 'test',
+ color: 'red',
+ description: 'testing',
+ },
+ ],
+ assignees: [
+ {
+ id: 1,
+ name: 'name',
+ username: 'username',
+ avatar_url: 'http://avatar_url',
+ },
+ ],
});
});
@@ -45,7 +49,7 @@ describe('Issue model', () => {
id: 2,
title: 'bug',
color: 'blue',
- description: 'bugs!'
+ description: 'bugs!',
});
expect(issue.labels.length).toBe(2);
@@ -56,7 +60,7 @@ describe('Issue model', () => {
id: 2,
title: 'test',
color: 'blue',
- description: 'bugs!'
+ description: 'bugs!',
});
expect(issue.labels.length).toBe(1);
@@ -80,7 +84,7 @@ describe('Issue model', () => {
id: 2,
title: 'bug',
color: 'blue',
- description: 'bugs!'
+ description: 'bugs!',
});
expect(issue.labels.length).toBe(2);
@@ -158,7 +162,7 @@ describe('Issue model', () => {
});
describe('update', () => {
- it('passes assignee ids when there are assignees', (done) => {
+ it('passes assignee ids when there are assignees', done => {
spyOn(Vue.http, 'patch').and.callFake((url, data) => {
expect(data.issue.assignee_ids).toEqual([1]);
done();
@@ -167,7 +171,7 @@ describe('Issue model', () => {
issue.update('url');
});
- it('passes assignee ids of [0] when there are no assignees', (done) => {
+ it('passes assignee ids of [0] when there are no assignees', done => {
spyOn(Vue.http, 'patch').and.callFake((url, data) => {
expect(data.issue.assignee_ids).toEqual([0]);
done();
diff --git a/spec/javascripts/boards/list_spec.js b/spec/javascripts/boards/list_spec.js
index 667fb710062..0d462a6f872 100644
--- a/spec/javascripts/boards/list_spec.js
+++ b/spec/javascripts/boards/list_spec.js
@@ -31,21 +31,21 @@ describe('List model', () => {
mock.restore();
});
- it('gets issues when created', (done) => {
+ it('gets issues when created', done => {
setTimeout(() => {
expect(list.issues.length).toBe(1);
done();
}, 0);
});
- it('saves list and returns ID', (done) => {
+ it('saves list and returns ID', done => {
list = new List({
title: 'test',
label: {
id: _.random(10000),
title: 'test',
- color: 'red'
- }
+ color: 'red',
+ },
});
list.save();
@@ -57,7 +57,7 @@ describe('List model', () => {
}, 0);
});
- it('destroys the list', (done) => {
+ it('destroys the list', done => {
boardsStore.addList(listObj);
list = boardsStore.findList('id', listObj.id);
@@ -70,7 +70,7 @@ describe('List model', () => {
}, 0);
});
- it('gets issue from list', (done) => {
+ it('gets issue from list', done => {
setTimeout(() => {
const issue = list.findIssue(1);
@@ -79,7 +79,7 @@ describe('List model', () => {
}, 0);
});
- it('removes issue', (done) => {
+ it('removes issue', done => {
setTimeout(() => {
const issue = list.findIssue(1);
@@ -109,8 +109,13 @@ describe('List model', () => {
listDup.updateIssueLabel(issue, list);
- expect(gl.boardService.moveIssue)
- .toHaveBeenCalledWith(issue.id, list.id, listDup.id, undefined, undefined);
+ expect(gl.boardService.moveIssue).toHaveBeenCalledWith(
+ issue.id,
+ list.id,
+ listDup.id,
+ undefined,
+ undefined,
+ );
});
describe('page number', () => {
@@ -120,14 +125,16 @@ describe('List model', () => {
it('increase page number if current issue count is more than the page size', () => {
for (let i = 0; i < 30; i += 1) {
- list.issues.push(new ListIssue({
- title: 'Testing',
- id: _.random(10000) + i,
- iid: _.random(10000) + i,
- confidential: false,
- labels: [list.label],
- assignees: [],
- }));
+ list.issues.push(
+ new ListIssue({
+ title: 'Testing',
+ id: _.random(10000) + i,
+ iid: _.random(10000) + i,
+ confidential: false,
+ labels: [list.label],
+ assignees: [],
+ }),
+ );
}
list.issuesSize = 50;
@@ -140,13 +147,15 @@ describe('List model', () => {
});
it('does not increase page number if issue count is less than the page size', () => {
- list.issues.push(new ListIssue({
- title: 'Testing',
- id: _.random(10000),
- confidential: false,
- labels: [list.label],
- assignees: [],
- }));
+ list.issues.push(
+ new ListIssue({
+ title: 'Testing',
+ id: _.random(10000),
+ confidential: false,
+ labels: [list.label],
+ assignees: [],
+ }),
+ );
list.issuesSize = 2;
list.nextPage();
@@ -158,21 +167,25 @@ describe('List model', () => {
describe('newIssue', () => {
beforeEach(() => {
- spyOn(gl.boardService, 'newIssue').and.returnValue(Promise.resolve({
- data: {
- id: 42,
- },
- }));
+ spyOn(gl.boardService, 'newIssue').and.returnValue(
+ Promise.resolve({
+ data: {
+ id: 42,
+ },
+ }),
+ );
});
- it('adds new issue to top of list', (done) => {
- list.issues.push(new ListIssue({
- title: 'Testing',
- id: _.random(10000),
- confidential: false,
- labels: [list.label],
- assignees: [],
- }));
+ it('adds new issue to top of list', done => {
+ list.issues.push(
+ new ListIssue({
+ title: 'Testing',
+ id: _.random(10000),
+ confidential: false,
+ labels: [list.label],
+ assignees: [],
+ }),
+ );
const dummyIssue = new ListIssue({
title: 'new issue',
id: _.random(10000),
@@ -181,7 +194,8 @@ describe('List model', () => {
assignees: [],
});
- list.newIssue(dummyIssue)
+ list
+ .newIssue(dummyIssue)
.then(() => {
expect(list.issues.length).toBe(2);
expect(list.issues[0]).toBe(dummyIssue);