Commit 12900923 authored by Florie Guibert's avatar Florie Guibert

Fix creating issue in milestone list

Review feedback
parent e7b3a118
import { sortBy, cloneDeep } from 'lodash';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import { ListType } from './constants';
import { ListType, MilestoneIDs } from './constants';
export function getMilestone() {
return null;
......@@ -109,7 +109,9 @@ export function formatIssueInput(issueInput, boardConfig) {
return {
...issueInput,
milestoneId:
milestoneId && milestoneId !== -1 ? fullMilestoneId(milestoneId) : issueInput.milestoneId,
milestoneId && milestoneId !== MilestoneIDs.ANY
? fullMilestoneId(milestoneId)
: issueInput?.milestoneId,
labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])],
assigneeIds: [...assigneeIds, ...(assigneeId ? [fullUserId(assigneeId)] : [])],
};
......
......@@ -119,6 +119,11 @@ export const DraggableItemTypes = {
list: 'list',
};
export const MilestoneIDs = {
NONE: 0,
ANY: -1,
};
export default {
BoardType,
ListType,
......
......@@ -53,6 +53,7 @@ export const MilestoneFilterType = {
export const MilestoneIDs = {
NONE: 0,
ANY: -1,
};
export const ANY_MILESTONE = {
......
......@@ -28,17 +28,7 @@ RSpec.describe 'Issue Boards new issue', :js do
end
it 'successfully assigns weight to newly-created issue' do
page.within(first('.board')) do
find('.issue-count-badge-add-button').click
end
page.within(first('.board-new-issue-form')) do
fill_in 'issue_title', with: 'new issue'
click_button 'Create issue'
end
wait_for_requests
create_issue_in_board_list(0)
page.within(first('.board')) do
find('.board-card').click
......@@ -58,16 +48,7 @@ RSpec.describe 'Issue Boards new issue', :js do
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
create_issue_in_board_list(1)
page.within(all('.board')[1]) do
find('.board-card').click
......@@ -83,4 +64,17 @@ RSpec.describe 'Issue Boards new issue', :js do
end
end
end
def create_issue_in_board_list(list_index)
page.within(all('.board')[list_index]) 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
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