Commit fa0b1253 authored by Sean McGivern's avatar Sean McGivern

Merge branch '3369-group-board-create-label' into 'master'

fix creating labels from Group Boards sidebar

Closes #3369

See merge request gitlab-org/gitlab-ee!2869
parents 2ed72580 a0bb234b
......@@ -25,7 +25,7 @@
show_any: "true",
project_id: @project&.try(:id),
labels: labels_filter_path(false),
namespace_path: @project.try(:namespace).try(:full_path),
namespace_path: @namespace_path,
project_path: @project.try(:path) },
":data-issue-update" => "'#{build_issue_link_base}/' + issue.iid + '.json'" }
%span.dropdown-toggle-text
......
require 'spec_helper'
describe 'label issues', :js do
include BoardHelpers
let(:user) { create(:user) }
let(:group) { create(:group, :public) }
let(:project) { create(:project, :public, namespace: group) }
let(:board) { create(:board, group: group) }
let!(:development) { create(:label, project: project, name: 'Development') }
let!(:issue) { create(:labeled_issue, project: project, labels: [development]) }
let!(:list) { create(:list, board: board, label: development, position: 0) }
before do
stub_licensed_features(group_issue_boards: true)
group.add_master(user)
sign_in(user)
visit group_boards_path(group)
wait_for_requests
end
it 'adds a new label from sidebar' do
card = find('.board:nth-child(2)').first('.card')
click_card(card)
page.within '.right-sidebar .labels' do
click_link 'Edit'
click_link 'Create new label'
fill_in 'new_label_name', with: 'test label'
first('.suggest-colors-dropdown a').click
click_button 'Create'
wait_for_requests
end
page.within '.labels' do
expect(page).to have_link 'test label'
end
end
end
require 'rails_helper'
describe 'Issue Boards', :js do
include BoardHelpers
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:project) { create(:project, :public) }
......@@ -137,19 +139,4 @@ describe 'Issue Boards', :js do
end
end
end
def click_card(card)
page.within(card) do
first('.card-number').click
end
wait_for_sidebar
end
def wait_for_sidebar
# loop until the CSS transition is complete
Timeout.timeout(0.5) do
loop until evaluate_script('$(".right-sidebar").outerWidth()') == 290
end
end
end
require 'rails_helper'
describe 'Issue Boards', :js do
include BoardHelpers
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:project) { create(:project, :public) }
......@@ -310,6 +312,21 @@ describe 'Issue Boards', :js do
expect(card).to have_selector('.label', count: 1)
expect(card).not_to have_content(stretch.title)
end
it 'creates new label' do
click_card(card)
page.within('.labels') do
click_link 'Edit'
click_link 'Create new label'
fill_in 'new_label_name', with: 'test label'
first('.suggest-colors-dropdown a').click
click_button 'Create'
wait_for_requests
expect(page).to have_link 'test label'
end
end
end
context 'subscription' do
......@@ -323,19 +340,4 @@ describe 'Issue Boards', :js do
end
end
end
def click_card(card)
page.within(card) do
first('.card-number').click
end
wait_for_sidebar
end
def wait_for_sidebar
# loop until the CSS transition is complete
Timeout.timeout(0.5) do
loop until evaluate_script('$(".right-sidebar").outerWidth()') == 290
end
end
end
module BoardHelpers
def click_card(card)
within card do
first('.card-number').click
end
wait_for_sidebar
end
def wait_for_sidebar
# loop until the CSS transition is complete
Timeout.timeout(0.5) do
loop until evaluate_script('$(".right-sidebar").outerWidth()') == 290
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