diff options
author | Phil Hughes <me@iamphill.com> | 2016-08-10 18:29:55 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-08-17 17:17:39 +0100 |
commit | 63a4daa555477432663a8dceaf012e2dcd4ca7fa (patch) | |
tree | f51f7f87f6bbc48094b79dfabf4c136f9ec6f987 | |
parent | 3f769e7848d30d0cc26f9e4043afd34b1631d62f (diff) | |
download | gitlab-ce-63a4daa555477432663a8dceaf012e2dcd4ca7fa.tar.gz |
Fixed failing teaspoon tests
-rw-r--r-- | app/assets/javascripts/boards/models/issue.js.es6 | 8 | ||||
-rw-r--r-- | app/assets/javascripts/boards/models/label.js.es6 | 2 | ||||
-rw-r--r-- | app/assets/javascripts/boards/models/list.js.es6 | 6 | ||||
-rw-r--r-- | app/assets/javascripts/boards/models/user.js.es6 | 2 | ||||
-rw-r--r-- | spec/javascripts/boards/boards_store_spec.js.es6 | 9 | ||||
-rw-r--r-- | spec/javascripts/boards/issue_spec.js.es6 | 2 |
6 files changed, 15 insertions, 14 deletions
diff --git a/app/assets/javascripts/boards/models/issue.js.es6 b/app/assets/javascripts/boards/models/issue.js.es6 index e16d4341212..1af3ded386b 100644 --- a/app/assets/javascripts/boards/models/issue.js.es6 +++ b/app/assets/javascripts/boards/models/issue.js.es6 @@ -1,17 +1,17 @@ -class Issue { +class ListIssue { constructor (obj) { this.id = obj.iid; this.title = obj.title; this.confidential = obj.confidential; if (obj.assignee) { - this.assignee = new User(obj.assignee); + this.assignee = new ListUser(obj.assignee); } this.labels = []; _.each(obj.labels, (label) => { - this.labels.push(new Label(label)); + this.labels.push(new ListLabel(label)); }); this.priority = _.reduce(this.labels, (max, label) => { @@ -24,7 +24,7 @@ class Issue { const hasLabel = this.findLabel(label); if (!hasLabel) { - this.labels.push(new Label(label)); + this.labels.push(new ListLabel(label)); } } } diff --git a/app/assets/javascripts/boards/models/label.js.es6 b/app/assets/javascripts/boards/models/label.js.es6 index 974e59d725e..e81e91fe972 100644 --- a/app/assets/javascripts/boards/models/label.js.es6 +++ b/app/assets/javascripts/boards/models/label.js.es6 @@ -1,4 +1,4 @@ -class Label { +class ListLabel { constructor (obj) { this.id = obj.id; this.title = obj.title; diff --git a/app/assets/javascripts/boards/models/list.js.es6 b/app/assets/javascripts/boards/models/list.js.es6 index 60214e2c798..662ab7354d4 100644 --- a/app/assets/javascripts/boards/models/list.js.es6 +++ b/app/assets/javascripts/boards/models/list.js.es6 @@ -10,7 +10,7 @@ class List { this.issues = []; if (obj.label) { - this.label = new Label(obj.label); + this.label = new ListLabel(obj.label); } if (this.type !== 'blank' && this.id) { @@ -85,8 +85,8 @@ class List { } createIssues (data) { - _.each(data, (issue) => { - this.issues.push(new Issue(issue)); + _.each(data, (issueObj) => { + this.issues.push(new ListIssue(issueObj)); }); } diff --git a/app/assets/javascripts/boards/models/user.js.es6 b/app/assets/javascripts/boards/models/user.js.es6 index e6b35569f77..904b3a68507 100644 --- a/app/assets/javascripts/boards/models/user.js.es6 +++ b/app/assets/javascripts/boards/models/user.js.es6 @@ -1,4 +1,4 @@ -class User { +class ListUser { constructor (user) { this.id = user.id; this.name = user.name; diff --git a/spec/javascripts/boards/boards_store_spec.js.es6 b/spec/javascripts/boards/boards_store_spec.js.es6 index c3c979a2a7f..ef59bac6e56 100644 --- a/spec/javascripts/boards/boards_store_spec.js.es6 +++ b/spec/javascripts/boards/boards_store_spec.js.es6 @@ -54,6 +54,7 @@ setTimeout(() => { expect(list.issues.length).toBe(1); + expect(list.issues[0].id).toBe(1); done(); }, 0); }); @@ -135,10 +136,10 @@ expect(BoardsStore.state.lists.length).toBe(2); - setTimeout(() => { - const list = BoardsStore.findList('id', 1); - const listTwo = BoardsStore.findList('id', 2); + const list = BoardsStore.findList('id', 1), + listTwo = BoardsStore.findList('id', 2); + setTimeout(() => { expect(list.issues.length).toBe(1); expect(listTwo.issues.length).toBe(1); @@ -148,7 +149,7 @@ expect(listTwo.issues.length).toBe(1); done(); - }); + }, 0); }); }); }); diff --git a/spec/javascripts/boards/issue_spec.js.es6 b/spec/javascripts/boards/issue_spec.js.es6 index b31bd74302a..b53be896872 100644 --- a/spec/javascripts/boards/issue_spec.js.es6 +++ b/spec/javascripts/boards/issue_spec.js.es6 @@ -19,7 +19,7 @@ describe('Issue model', () => { gl.boardService = new BoardService('/test/issue-boards/board'); BoardsStore.create(); - issue = new Issue({ + issue = new ListIssue({ title: 'Testing', iid: 1, confidential: false, |