Commit e7b3a118 authored by Florie Guibert's avatar Florie Guibert

Fix creating issue in milestone list

Changelog: fixed
EE: true
parent b0e75d46
...@@ -108,7 +108,8 @@ export function formatIssueInput(issueInput, boardConfig) { ...@@ -108,7 +108,8 @@ export function formatIssueInput(issueInput, boardConfig) {
return { return {
...issueInput, ...issueInput,
milestoneId: milestoneId ? fullMilestoneId(milestoneId) : null, milestoneId:
milestoneId && milestoneId !== -1 ? fullMilestoneId(milestoneId) : issueInput.milestoneId,
labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])], labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])],
assigneeIds: [...assigneeIds, ...(assigneeId ? [fullUserId(assigneeId)] : [])], assigneeIds: [...assigneeIds, ...(assigneeId ? [fullUserId(assigneeId)] : [])],
}; };
......
...@@ -3,10 +3,17 @@ ...@@ -3,10 +3,17 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Issue Boards new issue', :js do RSpec.describe 'Issue Boards new issue', :js do
let_it_be(:user) { create(:user) } before do
let_it_be(:project) { create(:project, :public) } stub_licensed_features(board_milestone_lists: true)
let_it_be(:board) { create(:board, project: project) } end
let_it_be(:backlog_list) { create(:backlog_list, board: board) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:milestone) { create(:milestone, project: project, title: 'Milestone 1') }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:backlog_list) { create(:backlog_list, board: board) }
let!(:milestone_list) { create(:milestone_list, board: board, milestone: milestone, position: 0) }
context 'authorized user' do context 'authorized user' do
before do before do
...@@ -17,7 +24,7 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -17,7 +24,7 @@ RSpec.describe 'Issue Boards new issue', :js do
visit project_board_path(project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 2) expect(page).to have_selector('.board', count: 3)
end end
it 'successfully assigns weight to newly-created issue' do it 'successfully assigns weight to newly-created issue' do
...@@ -48,5 +55,32 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -48,5 +55,32 @@ RSpec.describe 'Issue Boards new issue', :js do
expect(find('.board-card-weight .board-card-info-text').text).to eq("10") expect(find('.board-card-weight .board-card-info-text').text).to eq("10")
end end
end end
describe 'milestone list' do
it 'successfuly loads milestone to be added to newly created issue' do
page.within(all('.board')[1]) do
click_button 'New issue'
end
page.within(first('.board-new-issue-form')) do
find('.form-control').set('new issue')
click_button 'Create issue'
end
wait_for_requests
page.within(all('.board')[1]) do
find('.board-card').click
end
page.within('[data-testid="sidebar-milestones"]') do
click_button 'Edit'
wait_for_requests
expect(page).to have_content 'Milestone 1'
end
end
end
end end
end end
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