summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFelipe Artur <fcardozo@gitlab.com>2018-07-30 13:44:41 +0000
committerPhil Hughes <me@iamphill.com>2018-07-30 13:44:41 +0000
commit5815c5b48ac03dbd89a239e87c0f49216a428563 (patch)
tree7af892c202f2e00ee79d2646d5429ee466ff3ded /spec
parent4f08343463d6a987ad3415d410b38b4f9dde67a2 (diff)
downloadgitlab-ce-5815c5b48ac03dbd89a239e87c0f49216a428563.tar.gz
[Backport] View summed weights of issues in board column
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/boards/issues_controller_spec.rb4
-rw-r--r--spec/javascripts/boards/boards_store_spec.js22
-rw-r--r--spec/support/shared_examples/services/boards/issues_list_service.rb10
3 files changed, 34 insertions, 2 deletions
diff --git a/spec/controllers/boards/issues_controller_spec.rb b/spec/controllers/boards/issues_controller_spec.rb
index ce7762691c9..d98e6ff0df8 100644
--- a/spec/controllers/boards/issues_controller_spec.rb
+++ b/spec/controllers/boards/issues_controller_spec.rb
@@ -42,7 +42,7 @@ describe Boards::IssuesController do
parsed_response = JSON.parse(response.body)
expect(response).to match_response_schema('issues')
- expect(parsed_response.length).to eq 2
+ expect(parsed_response['issues'].length).to eq 2
expect(development.issues.map(&:relative_position)).not_to include(nil)
end
@@ -80,7 +80,7 @@ describe Boards::IssuesController do
parsed_response = JSON.parse(response.body)
expect(response).to match_response_schema('issues')
- expect(parsed_response.length).to eq 2
+ expect(parsed_response['issues'].length).to eq 2
end
end
diff --git a/spec/javascripts/boards/boards_store_spec.js b/spec/javascripts/boards/boards_store_spec.js
index f7af099b3bf..1ee6f4cf680 100644
--- a/spec/javascripts/boards/boards_store_spec.js
+++ b/spec/javascripts/boards/boards_store_spec.js
@@ -161,6 +161,28 @@ describe('Store', () => {
}, 0);
});
+ it('moves an issue from backlog to a list', (done) => {
+ const backlog = gl.issueBoards.BoardsStore.addList({
+ ...listObj,
+ list_type: 'backlog',
+ });
+ const listTwo = gl.issueBoards.BoardsStore.addList(listObjDuplicate);
+
+ expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(2);
+
+ setTimeout(() => {
+ expect(backlog.issues.length).toBe(1);
+ expect(listTwo.issues.length).toBe(1);
+
+ gl.issueBoards.BoardsStore.moveIssueToList(backlog, listTwo, backlog.findIssue(1));
+
+ expect(backlog.issues.length).toBe(0);
+ expect(listTwo.issues.length).toBe(1);
+
+ done();
+ }, 0);
+ });
+
it('moves issue to top of another list', (done) => {
const listOne = gl.issueBoards.BoardsStore.addList(listObj);
const listTwo = gl.issueBoards.BoardsStore.addList(listObjDuplicate);
diff --git a/spec/support/shared_examples/services/boards/issues_list_service.rb b/spec/support/shared_examples/services/boards/issues_list_service.rb
index 3e744323cea..8b879cef084 100644
--- a/spec/support/shared_examples/services/boards/issues_list_service.rb
+++ b/spec/support/shared_examples/services/boards/issues_list_service.rb
@@ -7,6 +7,16 @@ shared_examples 'issues list service' do
described_class.new(parent, user, params).execute
end
+ context '#metadata' do
+ it 'returns issues count for list' do
+ params = { board_id: board.id, id: list1.id }
+
+ metadata = described_class.new(parent, user, params).metadata
+
+ expect(metadata[:size]).to eq(3)
+ end
+ end
+
context 'issues are ordered by priority' do
it 'returns opened issues when list_id is missing' do
params = { board_id: board.id }