Commit 90f4d4f1 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '323446-display-sidebar-after-user-creates-a-new-issue-in-boards' into 'master'

Open sidebar after user creates a new item in boards [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!70352
parents 6e3a02b0 ce26124e
...@@ -603,7 +603,7 @@ export default { ...@@ -603,7 +603,7 @@ export default {
}); });
}, },
addListItem: ({ commit }, { list, item, position, inProgress = false }) => { addListItem: ({ commit, dispatch }, { list, item, position, inProgress = false }) => {
commit(types.ADD_BOARD_ITEM_TO_LIST, { commit(types.ADD_BOARD_ITEM_TO_LIST, {
listId: list.id, listId: list.id,
itemId: item.id, itemId: item.id,
...@@ -611,6 +611,9 @@ export default { ...@@ -611,6 +611,9 @@ export default {
inProgress, inProgress,
}); });
commit(types.UPDATE_BOARD_ITEM, item); commit(types.UPDATE_BOARD_ITEM, item);
if (!inProgress) {
dispatch('setActiveId', { id: item.id, sidebarType: ISSUABLE });
}
}, },
removeListItem: ({ commit }, { listId, itemId }) => { removeListItem: ({ commit }, { listId, itemId }) => {
......
...@@ -30,10 +30,6 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -30,10 +30,6 @@ RSpec.describe 'Issue Boards new issue', :js do
it 'successfully assigns weight to newly-created issue' do it 'successfully assigns weight to newly-created issue' do
create_issue_in_board_list(0) create_issue_in_board_list(0)
page.within(first('.board')) do
find('.board-card').click
end
page.within(first('[data-testid="issue-boards-sidebar"]')) do page.within(first('[data-testid="issue-boards-sidebar"]')) do
find('.weight [data-testid="edit-button"]').click find('.weight [data-testid="edit-button"]').click
find('.weight .form-control').set("10\n") find('.weight .form-control').set("10\n")
...@@ -50,10 +46,6 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -50,10 +46,6 @@ RSpec.describe 'Issue Boards new issue', :js do
it 'successfuly loads milestone to be added to newly created issue' do it 'successfuly loads milestone to be added to newly created issue' do
create_issue_in_board_list(1) create_issue_in_board_list(1)
page.within(all('.board')[1]) do
find('.board-card').click
end
page.within('[data-testid="sidebar-milestones"]') do page.within('[data-testid="sidebar-milestones"]') do
click_button 'Edit' click_button 'Edit'
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'create epic in board', :js do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group, :public) }
let_it_be(:epic_board) { create(:epic_board, group: group) }
let_it_be(:label) { create(:group_label, group: group, name: 'Label1') }
let_it_be(:label_list) { create(:epic_list, epic_board: epic_board, label: label, position: 0) }
let_it_be(:backlog_list) { create(:epic_list, epic_board: epic_board, list_type: :backlog) }
let_it_be(:closed_list) { create(:epic_list, epic_board: epic_board, list_type: :closed) }
context 'new epics in board list' do
before do
stub_licensed_features(epics: true)
group.add_maintainer(user)
sign_in(user)
visit_epic_boards_page
end
it 'creates new epic and opens sidebar' do
page.within(first('.board')) do
click_button 'New epic'
end
page.within(first('.board-new-issue-form')) do
find('.form-control').set('epic bug')
click_button 'Create epic'
end
wait_for_requests
page.within(first('.board .issue-count-badge-count')) do
expect(page).to have_content('1')
end
page.within(first('.board-card')) do
epic = group.epics.find_by_title('epic bug')
expect(page).to have_content(epic.to_reference)
expect(page).to have_link(epic.title, href: /#{epic_path(epic)}/)
end
expect(page).to have_selector('[data-testid="epic-boards-sidebar"]')
end
def visit_epic_boards_page
visit group_epic_boards_path(group)
wait_for_requests
end
end
end
...@@ -56,7 +56,7 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -56,7 +56,7 @@ RSpec.describe 'Issue Boards new issue', :js do
end end
end end
it 'creates new issue' do it 'creates new issue and opens sidebar' do
page.within(first('.board')) do page.within(first('.board')) do
click_button 'New issue' click_button 'New issue'
end end
...@@ -78,20 +78,6 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -78,20 +78,6 @@ RSpec.describe 'Issue Boards new issue', :js do
expect(page).to have_content(issue.to_reference) expect(page).to have_content(issue.to_reference)
expect(page).to have_link(issue.title, href: /#{issue_path(issue)}/) expect(page).to have_link(issue.title, href: /#{issue_path(issue)}/)
end end
end
# TODO https://gitlab.com/gitlab-org/gitlab/-/issues/323446
xit 'shows sidebar when creating new issue' do
page.within(first('.board')) do
click_button 'New issue'
end
page.within(first('.board-new-issue-form')) do
find('.form-control').set('bug')
click_button 'Create issue'
end
wait_for_requests
expect(page).to have_selector('[data-testid="issue-boards-sidebar"]') expect(page).to have_selector('[data-testid="issue-boards-sidebar"]')
end end
...@@ -108,10 +94,6 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -108,10 +94,6 @@ RSpec.describe 'Issue Boards new issue', :js do
wait_for_requests wait_for_requests
page.within(first('.board')) do
find('.board-card').click
end
page.within('[data-testid="sidebar-labels"]') do page.within('[data-testid="sidebar-labels"]') do
click_button 'Edit' click_button 'Edit'
......
...@@ -1331,9 +1331,41 @@ describe('addListItem', () => { ...@@ -1331,9 +1331,41 @@ describe('addListItem', () => {
list: mockLists[0], list: mockLists[0],
item: mockIssue, item: mockIssue,
position: 0, position: 0,
inProgress: true,
}; };
testAction(actions.addListItem, payload, {}, [ testAction(
actions.addListItem,
payload,
{},
[
{
type: types.ADD_BOARD_ITEM_TO_LIST,
payload: {
listId: mockLists[0].id,
itemId: mockIssue.id,
atIndex: 0,
inProgress: true,
},
},
{ type: types.UPDATE_BOARD_ITEM, payload: mockIssue },
],
[],
);
});
it('should commit ADD_BOARD_ITEM_TO_LIST and UPDATE_BOARD_ITEM mutations, dispatch setActiveId action when inProgress is false', () => {
const payload = {
list: mockLists[0],
item: mockIssue,
position: 0,
};
testAction(
actions.addListItem,
payload,
{},
[
{ {
type: types.ADD_BOARD_ITEM_TO_LIST, type: types.ADD_BOARD_ITEM_TO_LIST,
payload: { payload: {
...@@ -1344,7 +1376,9 @@ describe('addListItem', () => { ...@@ -1344,7 +1376,9 @@ describe('addListItem', () => {
}, },
}, },
{ type: types.UPDATE_BOARD_ITEM, payload: mockIssue }, { type: types.UPDATE_BOARD_ITEM, payload: mockIssue },
]); ],
[{ type: 'setActiveId', payload: { id: mockIssue.id, sidebarType: ISSUABLE } }],
);
}); });
}); });
......
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