Commit fb77b058 authored by Simon Knox's avatar Simon Knox

fix remaining karma tests

parent 6c402008
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
this.showIssueForm = !this.showIssueForm; this.showIssueForm = !this.showIssueForm;
}, },
onScroll() { onScroll() {
if ((this.scrollTop() > this.scrollHeight() - this.scrollOffset) && !this.list.loadingMore) { if (!this.list.loadingMore && (this.scrollTop() > this.scrollHeight() - this.scrollOffset)) {
this.loadNextPage(); this.loadNextPage();
} }
}, },
...@@ -163,7 +163,7 @@ export default { ...@@ -163,7 +163,7 @@ export default {
this.$refs.list.removeEventListener('scroll', this.onScroll); this.$refs.list.removeEventListener('scroll', this.onScroll);
}, },
template: ` template: `
<transition-group tag="div" class="board-list-component"> <div class="board-list-component">
<div <div
key="loading" key="loading"
class="board-list-loading text-center" class="board-list-loading text-center"
...@@ -212,6 +212,6 @@ export default { ...@@ -212,6 +212,6 @@ export default {
</span> </span>
</li> </li>
</ul> </ul>
</transition-group> </div>
`, `,
}; };
...@@ -33,7 +33,9 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({ ...@@ -33,7 +33,9 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
const issue = this.issue; const issue = this.issue;
const lists = issue.getLists(); const lists = issue.getLists();
const listLabelIds = lists.map(list => list.label.id); const listLabelIds = lists.map(list => list.label.id);
const labelIds = this.issue.labels.map(label => label.id).filter(id => !listLabelIds.includes(id)); const labelIds = this.issue.labels
.map(label => label.id)
.filter(id => !listLabelIds.includes(id));
const data = { const data = {
issue: { issue: {
label_ids: labelIds, label_ids: labelIds,
......
...@@ -94,7 +94,8 @@ class ListIssue { ...@@ -94,7 +94,8 @@ class ListIssue {
data.issue.label_ids = ['']; data.issue.label_ids = [''];
} }
return Vue.http.patch(url.replace(':project_path', this.project.path), data); const projectPath = this.project ? this.project.path : '';
return Vue.http.patch(url.replace(':project_path', projectPath), data);
} }
} }
......
...@@ -111,6 +111,7 @@ class List { ...@@ -111,6 +111,7 @@ class List {
.then(resp => resp.json()) .then(resp => resp.json())
.then((data) => { .then((data) => {
issue.id = data.id; issue.id = data.id;
issue.iid = data.iid;
issue.milestone = data.milestone; issue.milestone = data.milestone;
if (this.issuesSize > 1) { if (this.issuesSize > 1) {
......
...@@ -17,7 +17,7 @@ import '~/boards/services/board_service'; ...@@ -17,7 +17,7 @@ import '~/boards/services/board_service';
import '~/boards/stores/boards_store'; import '~/boards/stores/boards_store';
import { mockBoardService } from './mock_data'; import { mockBoardService } from './mock_data';
fdescribe('Store', () => { describe('Store', () => {
beforeEach(() => { beforeEach(() => {
Vue.http.interceptors.push(boardsMockInterceptor); Vue.http.interceptors.push(boardsMockInterceptor);
gl.boardService = mockBoardService(); gl.boardService = mockBoardService();
...@@ -210,6 +210,7 @@ fdescribe('Store', () => { ...@@ -210,6 +210,7 @@ fdescribe('Store', () => {
it('moves issue in list', (done) => { it('moves issue in list', (done) => {
const issue = new ListIssue({ const issue = new ListIssue({
title: 'Testing', title: 'Testing',
id: 2,
iid: 2, iid: 2,
confidential: false, confidential: false,
labels: [], labels: [],
......
...@@ -37,6 +37,7 @@ describe('Issue card component', () => { ...@@ -37,6 +37,7 @@ describe('Issue card component', () => {
list = listObj; list = listObj;
issue = new ListIssue({ issue = new ListIssue({
title: 'Testing', title: 'Testing',
id: 1,
iid: 1, iid: 1,
confidential: false, confidential: false,
labels: [list.label], labels: [list.label],
......
...@@ -21,6 +21,7 @@ describe('Issue model', () => { ...@@ -21,6 +21,7 @@ describe('Issue model', () => {
issue = new ListIssue({ issue = new ListIssue({
title: 'Testing', title: 'Testing',
id: 1,
iid: 1, iid: 1,
confidential: false, confidential: false,
labels: [{ labels: [{
......
...@@ -23,10 +23,7 @@ describe('List model', () => { ...@@ -23,10 +23,7 @@ describe('List model', () => {
beforeEach(() => { beforeEach(() => {
Vue.http.interceptors.push(boardsMockInterceptor); Vue.http.interceptors.push(boardsMockInterceptor);
gl.boardService = mockBoardService({ gl.boardService = mockBoardService({
boardsEndpoint: '/test/issue-boards/board',
listsEndpoint: '/boards/1',
bulkUpdatePath: '/test/issue-boards/board/1/lists', bulkUpdatePath: '/test/issue-boards/board/1/lists',
boardId: '1',
}); });
gl.issueBoards.BoardsStore.create(); gl.issueBoards.BoardsStore.create();
......
...@@ -44,24 +44,13 @@ const BoardsMockData = { ...@@ -44,24 +44,13 @@ const BoardsMockData = {
assignees: [], assignees: [],
}], }],
}, },
'/boards/1{/id}/issues': {
issues: [{
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [],
assignees: [],
}],
size: 1
},
'/test/issue-boards/milestones.json': [{ '/test/issue-boards/milestones.json': [{
id: 1, id: 1,
title: 'test', title: 'test',
}], }],
}, },
'POST': { 'POST': {
'/boards/1{/id}': listObj '/test/boards/1{/id}': listObj
}, },
'PUT': { 'PUT': {
'/test/issue-boards/board/1/lists{/id}': {} '/test/issue-boards/board/1/lists{/id}': {}
......
...@@ -18,6 +18,7 @@ describe('Modal store', () => { ...@@ -18,6 +18,7 @@ describe('Modal store', () => {
issue = new ListIssue({ issue = new ListIssue({
title: 'Testing', title: 'Testing',
id: 1,
iid: 1, iid: 1,
confidential: false, confidential: false,
labels: [], labels: [],
...@@ -25,6 +26,7 @@ describe('Modal store', () => { ...@@ -25,6 +26,7 @@ describe('Modal store', () => {
}); });
issue2 = new ListIssue({ issue2 = new ListIssue({
title: 'Testing', title: 'Testing',
id: 2,
iid: 2, iid: 2,
confidential: false, confidential: false,
labels: [], labels: [],
......
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