Commit 07016077 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Hide `new board`link when multiple issue boards isn't available

parent fd3c2b5c
......@@ -43,9 +43,11 @@
- if can?(current_user, :admin_board, @project)
.dropdown-footer{ "v-if" => "currentPage === ''" }
%ul.dropdown-footer-list
%li
%a{ "href" => "#", "@click.stop.prevent" => "showPage('new')" }
Create new board
- if @project.feature_available?(:multiple_issue_boards)
%li
%a{ "href" => "#", "@click.stop.prevent" => "showPage('new')" }
Create new board
%li
%a{ "href" => "#", "@click.stop.prevent" => "showPage('edit')" }
Edit board name
......
......@@ -7,154 +7,180 @@ describe 'Multiple Issue Boards', feature: true, js: true do
let!(:board) { create(:board, project: project) }
let!(:board2) { create(:board, project: project) }
context 'authorized user' do
context 'with multiple issue boards enabled' do
before do
project.team << [user, :master]
stub_licensed_features(multiple_issue_boards: true)
end
gitlab_sign_in(user)
context 'authorized user' do
before do
project.team << [user, :master]
visit project_boards_path(project)
wait_for_requests
end
login_as(user)
it 'shows current board name' do
page.within('.boards-switcher') do
expect(page).to have_content(board.name)
visit project_boards_path(project)
wait_for_requests
end
end
it 'shows a list of boards' do
click_button board.name
page.within('.dropdown-menu') do
expect(page).to have_content(board.name)
expect(page).to have_content(board2.name)
it 'shows current board name' do
page.within('.boards-switcher') do
expect(page).to have_content(board.name)
end
end
end
it 'switches current board' do
click_button board.name
it 'shows a list of boards' do
click_button board.name
page.within('.dropdown-menu') do
click_link board2.name
page.within('.dropdown-menu') do
expect(page).to have_content(board.name)
expect(page).to have_content(board2.name)
end
end
wait_for_requests
it 'switches current board' do
click_button board.name
page.within('.dropdown-menu') do
click_link board2.name
end
page.within('.boards-switcher') do
expect(page).to have_content(board2.name)
wait_for_requests
page.within('.boards-switcher') do
expect(page).to have_content(board2.name)
end
end
end
it 'creates new board' do
click_button board.name
it 'creates new board' do
click_button board.name
page.within('.dropdown-menu') do
click_link 'Edit board name'
page.within('.dropdown-menu') do
click_link 'Create new board'
fill_in 'board-new-name', with: 'Testing'
fill_in 'board-new-name', with: 'This is a new board'
click_button 'Save'
end
click_button 'Create'
end
wait_for_requests
wait_for_requests
page.within('.dropdown-menu') do
expect(page).to have_content('Testing')
expect(page).to have_button('This is a new board')
end
end
it 'edits board name' do
click_button board.name
it 'edits board name' do
click_button board.name
page.within('.dropdown-menu') do
click_link 'Edit board name'
page.within('.dropdown-menu') do
click_link 'Edit board name'
fill_in 'board-new-name', with: 'Testing'
fill_in 'board-new-name', with: 'Testing'
click_button 'Save'
end
click_button 'Save'
end
wait_for_requests
wait_for_requests
page.within('.dropdown-menu') do
expect(page).to have_content('Testing')
page.within('.dropdown-menu') do
expect(page).to have_content('Testing')
end
end
end
it 'deletes board' do
click_button board.name
it 'deletes board' do
click_button board.name
wait_for_requests
wait_for_requests
page.within('.dropdown-menu') do
click_link 'Delete board'
page.within('.dropdown-menu') do
click_link 'Delete board'
page.within('.dropdown-title') do
expect(page).to have_content('Delete board')
page.within('.dropdown-title') do
expect(page).to have_content('Delete board')
end
click_link 'Delete'
end
click_link 'Delete'
click_button board2.name
page.within('.dropdown-menu') do
expect(page).not_to have_content(board.name)
expect(page).to have_content(board2.name)
end
end
click_button board2.name
it 'adds a list to the none default board' do
click_button board.name
page.within('.dropdown-menu') do
expect(page).not_to have_content(board.name)
expect(page).to have_content(board2.name)
end
end
page.within('.dropdown-menu') do
click_link board2.name
end
it 'adds a list to the none default board' do
click_button board.name
wait_for_requests
page.within('.dropdown-menu') do
click_link board2.name
end
page.within('.boards-switcher') do
expect(page).to have_content(board2.name)
end
wait_for_requests
click_button 'Add list'
page.within('.boards-switcher') do
expect(page).to have_content(board2.name)
end
wait_for_requests
click_button 'Add list'
page.within '.dropdown-menu-issues-board-new' do
click_link planning.title
end
wait_for_requests
wait_for_requests
page.within '.dropdown-menu-issues-board-new' do
click_link planning.title
end
expect(page).to have_selector('.board', count: 3)
wait_for_requests
click_button board2.name
expect(page).to have_selector('.board', count: 3)
page.within('.dropdown-menu') do
click_link board.name
end
click_button board2.name
wait_for_requests
page.within('.dropdown-menu') do
click_link board.name
expect(page).to have_selector('.board', count: 2)
end
end
context 'unauthorized user' do
before do
visit project_boards_path(project)
wait_for_requests
end
wait_for_requests
it 'does not show action links' do
click_button board.name
expect(page).to have_selector('.board', count: 2)
page.within('.dropdown-menu') do
expect(page).not_to have_content('Create new board')
expect(page).not_to have_content('Edit board name')
expect(page).not_to have_content('Delete board')
end
end
end
end
context 'unauthorized user' do
context 'with multiple issue boards disabled' do
before do
stub_licensed_features(multiple_issue_boards: false)
project.team << [user, :master]
login_as(user)
visit project_boards_path(project)
wait_for_requests
end
it 'does not show action links' do
it 'hides the link to create a new board' do
click_button board.name
page.within('.dropdown-menu') do
expect(page).to have_content('Edit board name')
expect(page).not_to have_content('Create new board')
expect(page).not_to have_content('Edit board name')
expect(page).not_to have_content('Delete board')
expect(page).to have_content('Delete board')
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