Commit a8304104 authored by Florie Guibert's avatar Florie Guibert

Open sidebar after user creates a new item in boards

Changelog: fixed
parent dbf27167
......@@ -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, {
listId: list.id,
itemId: item.id,
......@@ -611,6 +611,9 @@ export default {
inProgress,
});
commit(types.UPDATE_BOARD_ITEM, item);
if (!inProgress) {
dispatch('setActiveId', { id: item.id, sidebarType: ISSUABLE });
}
},
removeListItem: ({ commit }, { listId, itemId }) => {
......
......@@ -30,10 +30,6 @@ RSpec.describe 'Issue Boards new issue', :js do
it 'successfully assigns weight to newly-created issue' do
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
find('.weight [data-testid="edit-button"]').click
find('.weight .form-control').set("10\n")
......@@ -50,10 +46,6 @@ RSpec.describe 'Issue Boards new issue', :js do
it 'successfuly loads milestone to be added to newly created issue' do
create_issue_in_board_list(1)
page.within(all('.board')[1]) do
find('.board-card').click
end
page.within('[data-testid="sidebar-milestones"]') do
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
end
end
it 'creates new issue' do
it 'creates new issue and opens sidebar' do
page.within(first('.board')) do
click_button 'New issue'
end
......@@ -78,20 +78,6 @@ RSpec.describe 'Issue Boards new issue', :js do
expect(page).to have_content(issue.to_reference)
expect(page).to have_link(issue.title, href: /#{issue_path(issue)}/)
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"]')
end
......@@ -108,10 +94,6 @@ RSpec.describe 'Issue Boards new issue', :js do
wait_for_requests
page.within(first('.board')) do
find('.board-card').click
end
page.within('[data-testid="sidebar-labels"]') do
click_button 'Edit'
......
......@@ -1326,25 +1326,31 @@ describe('setAssignees', () => {
});
describe('addListItem', () => {
it('should commit ADD_BOARD_ITEM_TO_LIST and UPDATE_BOARD_ITEM mutations', () => {
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,
payload: {
listId: mockLists[0].id,
itemId: mockIssue.id,
atIndex: 0,
inProgress: false,
testAction(
actions.addListItem,
payload,
{},
[
{
type: types.ADD_BOARD_ITEM_TO_LIST,
payload: {
listId: mockLists[0].id,
itemId: mockIssue.id,
atIndex: 0,
inProgress: false,
},
},
},
{ 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