Commit 8dd238ad authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'fix-search-bar-specs' into 'master'

[CE] Fix filter token not showing up when multiple assignees are enabled

See merge request gitlab-org/gitlab-ce!27759
parents 8b55b794 364d948b
......@@ -80,7 +80,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-author', visible: true)
expect_tokens([{ name: 'author' }])
expect_tokens([{ name: 'Author' }])
expect_filtered_search_input_empty
end
......@@ -89,7 +89,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-assignee', visible: true)
expect_tokens([{ name: 'assignee' }])
expect_tokens([{ name: 'Assignee' }])
expect_filtered_search_input_empty
end
......@@ -98,7 +98,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-milestone', visible: true)
expect_tokens([{ name: 'milestone' }])
expect_tokens([{ name: 'Milestone' }])
expect_filtered_search_input_empty
end
......@@ -107,7 +107,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-label', visible: true)
expect_tokens([{ name: 'label' }])
expect_tokens([{ name: 'Label' }])
expect_filtered_search_input_empty
end
......@@ -116,7 +116,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-my-reaction', visible: true)
expect_tokens([{ name: 'my-reaction' }])
expect_tokens([{ name: 'My-reaction' }])
expect_filtered_search_input_empty
end
......@@ -125,7 +125,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-confidential', visible: true)
expect_tokens([{ name: 'confidential' }])
expect_tokens([{ name: 'Confidential' }])
expect_filtered_search_input_empty
end
end
......@@ -137,7 +137,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-author', visible: true)
expect_tokens([{ name: 'author' }])
expect_tokens([{ name: 'Author' }])
expect_filtered_search_input_empty
end
......@@ -147,7 +147,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-assignee', visible: true)
expect_tokens([{ name: 'assignee' }])
expect_tokens([{ name: 'Assignee' }])
expect_filtered_search_input_empty
end
......@@ -157,7 +157,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-milestone', visible: true)
expect_tokens([{ name: 'milestone' }])
expect_tokens([{ name: 'Milestone' }])
expect_filtered_search_input_empty
end
......@@ -167,7 +167,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-label', visible: true)
expect_tokens([{ name: 'label' }])
expect_tokens([{ name: 'Label' }])
expect_filtered_search_input_empty
end
......@@ -177,7 +177,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-my-reaction', visible: true)
expect_tokens([{ name: 'my-reaction' }])
expect_tokens([{ name: 'My-reaction' }])
expect_filtered_search_input_empty
end
end
......@@ -189,7 +189,7 @@ describe 'Dropdown hint', :js do
filtered_search.send_keys(:backspace)
click_hint('author')
expect_tokens([{ name: 'author' }])
expect_tokens([{ name: 'Author' }])
expect_filtered_search_input_empty
end
......@@ -199,7 +199,7 @@ describe 'Dropdown hint', :js do
filtered_search.send_keys(:backspace)
click_hint('assignee')
expect_tokens([{ name: 'assignee' }])
expect_tokens([{ name: 'Assignee' }])
expect_filtered_search_input_empty
end
......@@ -209,7 +209,7 @@ describe 'Dropdown hint', :js do
filtered_search.send_keys(:backspace)
click_hint('milestone')
expect_tokens([{ name: 'milestone' }])
expect_tokens([{ name: 'Milestone' }])
expect_filtered_search_input_empty
end
......@@ -219,7 +219,7 @@ describe 'Dropdown hint', :js do
filtered_search.send_keys(:backspace)
click_hint('label')
expect_tokens([{ name: 'label' }])
expect_tokens([{ name: 'Label' }])
expect_filtered_search_input_empty
end
......@@ -229,7 +229,7 @@ describe 'Dropdown hint', :js do
filtered_search.send_keys(:backspace)
click_hint('my-reaction')
expect_tokens([{ name: 'my-reaction' }])
expect_tokens([{ name: 'My-reaction' }])
expect_filtered_search_input_empty
end
end
......@@ -247,7 +247,7 @@ describe 'Dropdown hint', :js do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-wip', visible: true)
expect_tokens([{ name: 'wip' }])
expect_tokens([{ name: 'WIP' }])
expect_filtered_search_input_empty
end
end
......
......@@ -78,20 +78,17 @@ module FilteredSearchHelpers
# .tokens-container to make sure the correct names and values are rendered
def expect_tokens(tokens)
page.within '.filtered-search-box .tokens-container' do
page.all(:css, '.tokens-container li .selectable').each_with_index do |el, index|
token_name = tokens[index][:name]
token_value = tokens[index][:value]
token_emoji = tokens[index][:emoji_name]
token_elements = page.all(:css, 'li.filtered-search-token')
expect(el.find('.name')).to have_content(token_name)
tokens.each_with_index do |token, index|
el = token_elements[index]
if token_value
expect(el.find('.value')).to have_content(token_value)
end
expect(el.find('.name')).to have_content(token[:name])
expect(el.find('.value')).to have_content(token[:value]) if token[:value].present?
# gl-emoji content is blank when the emoji unicode is not supported
if token_emoji
selector = %(gl-emoji[data-name="#{token_emoji}"])
if token[:emoji_name].present?
selector = %(gl-emoji[data-name="#{token[:emoji_name]}"])
expect(el.find('.value')).to have_css(selector)
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