04dc2b76d7
* master: (181 commits) Fixed adding to list bug Remove unnecessary queries for .atom and .json in Dashboard::ProjectsController#index Fixed modal lists dropdown not updating when list is deleted Fixed remove btn error after creating new issue in list Removed duplicated test Removed Masonry, instead uses groups of data Uses mixins for repeated functions Fixed up specs Props use objects with required & type values Removes labels instead of closing issue when clicking remove button Fixed JS lint errors Fixed issue card spec Added webkit CSS properties Fixed bug with empty state showing after search Fixed users href path being incorrect Fixed bug where 2 un-selected issues would stay on selected tab Fixed DB schema Changed how components are added in objects Added remove button Add optional id property to the issue schema Fixed issue link href Disabled add issues button if no lists exist ...
82 lines
1.8 KiB
JavaScript
82 lines
1.8 KiB
JavaScript
/* eslint-disable comma-dangle */
|
|
/* global BoardService */
|
|
/* global ListIssue */
|
|
|
|
require('~/lib/utils/url_utility');
|
|
require('~/boards/models/issue');
|
|
require('~/boards/models/label');
|
|
require('~/boards/models/list');
|
|
require('~/boards/models/user');
|
|
require('~/boards/services/board_service');
|
|
require('~/boards/stores/boards_store');
|
|
require('./mock_data');
|
|
|
|
describe('Issue model', () => {
|
|
let issue;
|
|
|
|
beforeEach(() => {
|
|
gl.boardService = new BoardService('/test/issue-boards/board', '', '1');
|
|
gl.issueBoards.BoardsStore.create();
|
|
|
|
issue = new ListIssue({
|
|
title: 'Testing',
|
|
iid: 1,
|
|
confidential: false,
|
|
labels: [{
|
|
id: 1,
|
|
title: 'test',
|
|
color: 'red',
|
|
description: 'testing'
|
|
}]
|
|
});
|
|
});
|
|
|
|
it('has label', () => {
|
|
expect(issue.labels.length).toBe(1);
|
|
});
|
|
|
|
it('add new label', () => {
|
|
issue.addLabel({
|
|
id: 2,
|
|
title: 'bug',
|
|
color: 'blue',
|
|
description: 'bugs!'
|
|
});
|
|
expect(issue.labels.length).toBe(2);
|
|
});
|
|
|
|
it('does not add existing label', () => {
|
|
issue.addLabel({
|
|
id: 2,
|
|
title: 'test',
|
|
color: 'blue',
|
|
description: 'bugs!'
|
|
});
|
|
|
|
expect(issue.labels.length).toBe(1);
|
|
});
|
|
|
|
it('finds label', () => {
|
|
const label = issue.findLabel(issue.labels[0]);
|
|
expect(label).toBeDefined();
|
|
});
|
|
|
|
it('removes label', () => {
|
|
const label = issue.findLabel(issue.labels[0]);
|
|
issue.removeLabel(label);
|
|
expect(issue.labels.length).toBe(0);
|
|
});
|
|
|
|
it('removes multiple labels', () => {
|
|
issue.addLabel({
|
|
id: 2,
|
|
title: 'bug',
|
|
color: 'blue',
|
|
description: 'bugs!'
|
|
});
|
|
expect(issue.labels.length).toBe(2);
|
|
|
|
issue.removeLabels([issue.labels[0], issue.labels[1]]);
|
|
expect(issue.labels.length).toBe(0);
|
|
});
|
|
});
|