Commit c9e87b80 authored by Brian Kabiro's avatar Brian Kabiro Committed by Clement Ho

Add check for hiding boards-switcher

parent 24ed1470
...@@ -88,7 +88,7 @@ module BoardsHelper ...@@ -88,7 +88,7 @@ module BoardsHelper
end end
def boards_link_text def boards_link_text
if current_board_parent.multiple_issue_boards_available? if multiple_boards_available?
s_("IssueBoards|Boards") s_("IssueBoards|Boards")
else else
s_("IssueBoards|Board") s_("IssueBoards|Board")
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.issues-filters{ class: ("w-100" if type == :boards_modal) } .issues-filters{ class: ("w-100" if type == :boards_modal) }
.issues-details-filters.filtered-search-block.d-flex.flex-column.flex-md-row{ class: block_css_class, "v-pre" => type == :boards_modal } .issues-details-filters.filtered-search-block.d-flex.flex-column.flex-md-row{ class: block_css_class, "v-pre" => type == :boards_modal }
- if type == :boards - if type == :boards && (multiple_boards_available? || current_board_parent.boards.size > 1)
= render "shared/boards/switcher", board: board = render "shared/boards/switcher", board: board
= form_tag page_filter_path, method: :get, class: 'filter-form js-filter-form w-100' do = form_tag page_filter_path, method: :get, class: 'filter-form js-filter-form w-100' do
- if params[:search].present? - if params[:search].present?
......
---
title: Hide boards-switcher on group boards
merge_request: 15293
author: briankabiro
type: changed
...@@ -19,28 +19,23 @@ describe 'Multiple Issue Boards', :js do ...@@ -19,28 +19,23 @@ describe 'Multiple Issue Boards', :js do
login_as(user) login_as(user)
end end
it 'hides the link to create a new board' do it 'does not show board switcher' do
visit boards_path visit boards_path
wait_for_requests wait_for_requests
click_button board.name expect(page).not_to have_css('.boards-switcher')
page.within('.js-boards-selector .dropdown-menu') do
expect(page).not_to have_content('Create new board')
expect(page).not_to have_content('Delete board')
end
end end
it 'does not show license warning when there is one board created' do it 'shows the board switcher when group has more than one board' do
create(:board, parent: parent)
visit boards_path visit boards_path
wait_for_requests wait_for_requests
click_button board.name expect(page).to have_css('.boards-switcher')
expect(page).not_to have_content('Some of your boards are hidden, activate a license to see them again.')
end end
it 'shows a license warning when group has more than one board' do it 'shows license warning when group has more than one board' do
create(:board, parent: parent) create(:board, parent: parent)
visit boards_path visit boards_path
......
...@@ -56,7 +56,8 @@ describe 'Labels Hierarchy', :js do ...@@ -56,7 +56,8 @@ describe 'Labels Hierarchy', :js do
context 'scoped boards' do context 'scoped boards' do
context 'for group boards' do context 'for group boards' do
let(:board) { create(:board, group: parent) } let!(:board) { create(:board, group: parent) }
let!(:board_2) { create(:board, group: parent) }
before do before do
visit group_board_path(parent, board) visit group_board_path(parent, board)
......
...@@ -11,6 +11,10 @@ shared_examples_for 'multiple issue boards' do ...@@ -11,6 +11,10 @@ shared_examples_for 'multiple issue boards' do
wait_for_requests wait_for_requests
end end
it 'shows board switcher' do
expect(page).to have_css('.boards-switcher')
end
it 'shows current board name' do it 'shows current board name' do
page.within('.boards-switcher') do page.within('.boards-switcher') do
expect(page).to have_content(board.name) expect(page).to have_content(board.name)
......
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