Commit 0352678e authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'tokenize-filtered-search' into 'master'

Use colon to tokenize input in filtered search

Closes #196084

See merge request gitlab-org/gitlab!26072
parents 2efc9606 a3a16ef6
......@@ -472,33 +472,6 @@ export default class FilteredSearchManager {
});
input.value = input.value.replace(`${tokenKey}:`, '');
}
const splitSearchToken = searchToken && searchToken.split(' ');
let lastSearchToken = _.last(splitSearchToken);
lastSearchToken = lastSearchToken?.toLowerCase();
/**
* If user writes "milestone", a known token, in the input, we should not
* wait for leading colon to flush it as a filter token.
*/
if (this.filteredSearchTokenKeys.getKeys().includes(lastSearchToken)) {
if (splitSearchToken.length > 1) {
splitSearchToken.pop();
const searchVisualTokens = splitSearchToken.join(' ');
input.value = input.value.replace(searchVisualTokens, '');
FilteredSearchVisualTokens.addSearchVisualToken(searchVisualTokens);
}
FilteredSearchVisualTokens.addFilterVisualToken(lastSearchToken, null, null, {
uppercaseTokenName: this.filteredSearchTokenKeys.shouldUppercaseTokenName(
lastSearchToken,
),
capitalizeTokenValue: this.filteredSearchTokenKeys.shouldCapitalizeTokenValue(
lastSearchToken,
),
});
input.value = input.value.replace(lastSearchToken, '');
}
} else if (!isLastVisualTokenValid && !FilteredSearchVisualTokens.getLastTokenOperator()) {
const tokenKey = FilteredSearchVisualTokens.getLastTokenPartial();
const tokenOperator = searchToken && searchToken.trim();
......
---
title: Use colon to tokenize input in filtered search
merge_request: 26072
author:
type: changed
......@@ -24,7 +24,7 @@ describe 'epics list', :js do
context 'editing author token' do
before do
input_filtered_search('author=@root', submit: false)
input_filtered_search('author:=@root', submit: false)
first('.tokens-container .filtered-search-token').click
end
......@@ -52,7 +52,7 @@ describe 'epics list', :js do
context 'editing label token' do
before do
input_filtered_search("label=~#{label.title}", submit: false)
input_filtered_search("label:=~#{label.title}", submit: false)
first('.tokens-container .filtered-search-token').click
end
......
......@@ -27,13 +27,13 @@ describe 'Dropdown epic', :js do
describe 'behavior' do
it 'loads all the epics when opened' do
input_filtered_search('epic=', submit: false, extra_space: false)
input_filtered_search('epic:=', submit: false, extra_space: false)
expect_filtered_search_dropdown_results(filter_dropdown, 2)
end
it 'selects epic and correct title is loaded' do
input_filtered_search('epic=', submit: false, extra_space: false)
input_filtered_search('epic:=', submit: false, extra_space: false)
wait_for_requests
find('li', text: epic.title).click
......@@ -42,7 +42,7 @@ describe 'Dropdown epic', :js do
end
it 'filters issues by epic' do
input_filtered_search('epic=', submit: false, extra_space: false)
input_filtered_search('epic:=', submit: false, extra_space: false)
wait_for_requests
find('li', text: epic2.title).click
......
......@@ -21,7 +21,7 @@ describe 'Dropdown weight', :js do
describe 'behavior' do
it 'loads all the weights when opened' do
input_filtered_search('weight=', submit: false, extra_space: false)
input_filtered_search('weight:=', submit: false, extra_space: false)
expect_filtered_search_dropdown_results(filter_dropdown, 21)
end
......
......@@ -40,7 +40,7 @@ describe 'Filter issues weight', :js do
describe 'only weight' do
it 'filter issues by searched weight' do
input_filtered_search('weight=1')
input_filtered_search('weight:=1')
expect_issues_list_count(1)
end
......@@ -48,7 +48,7 @@ describe 'Filter issues weight', :js do
describe 'weight with other filters' do
it 'filters issues by searched weight and text' do
search = "weight=2 bug"
search = "weight:=2 bug"
input_filtered_search(search)
expect_issues_list_count(1)
......@@ -56,7 +56,7 @@ describe 'Filter issues weight', :js do
end
it 'filters issues by searched weight, author and text' do
search = "weight=2 author=@root bug"
search = "weight:=2 author:=@root bug"
input_filtered_search(search)
expect_issues_list_count(1)
......@@ -64,7 +64,7 @@ describe 'Filter issues weight', :js do
end
it 'filters issues by searched weight, author, assignee and text' do
search = "weight=2 author=@root assignee=@root bug"
search = "weight:=2 author:=@root assignee:=@root bug"
input_filtered_search(search)
expect_issues_list_count(1)
......@@ -72,7 +72,7 @@ describe 'Filter issues weight', :js do
end
it 'filters issues by searched weight, author, assignee, label and text' do
search = "weight=2 author=@root assignee=@root label=~urgent bug"
search = "weight:=2 author:=@root assignee:=@root label:=~urgent bug"
input_filtered_search(search)
expect_issues_list_count(1)
......@@ -80,7 +80,7 @@ describe 'Filter issues weight', :js do
end
it 'filters issues by searched weight, milestone and text' do
search = "weight=2 milestone=%version1 bug"
search = "weight:=2 milestone:=%version1 bug"
input_filtered_search(search)
expect_issues_list_count(1)
......
......@@ -32,7 +32,7 @@ describe 'Merge Requests > User filters by approvers', :js do
context 'filtering by approver:none' do
it 'applies the filter' do
input_filtered_search('approver=none')
input_filtered_search('approver:=none')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
......@@ -45,7 +45,7 @@ describe 'Merge Requests > User filters by approvers', :js do
context 'filtering by approver:any' do
it 'applies the filter' do
input_filtered_search('approver=any')
input_filtered_search('approver:=any')
expect(page).to have_issuable_counts(open: 3, closed: 0, all: 3)
......@@ -58,7 +58,7 @@ describe 'Merge Requests > User filters by approvers', :js do
context 'filtering by approver:@username' do
it 'applies the filter' do
input_filtered_search("approver=@#{first_user.username}")
input_filtered_search("approver:=@#{first_user.username}")
expect(page).to have_issuable_counts(open: 2, closed: 0, all: 2)
......@@ -71,7 +71,7 @@ describe 'Merge Requests > User filters by approvers', :js do
context 'filtering by multiple approvers' do
it 'applies the filter' do
input_filtered_search("approver=@#{first_user.username} approver=@#{user.username}")
input_filtered_search("approver:=@#{first_user.username} approver:=@#{user.username}")
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
......@@ -84,7 +84,7 @@ describe 'Merge Requests > User filters by approvers', :js do
context 'filtering by an approver from a group' do
it 'applies the filter' do
input_filtered_search("approver=@#{group_user.username}")
input_filtered_search("approver:=@#{group_user.username}")
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
......
......@@ -57,7 +57,7 @@ describe "Admin Runners" do
expect(page).to have_content 'runner-active'
expect(page).to have_content 'runner-paused'
input_filtered_search_keys('status=active')
input_filtered_search_keys('status:=active')
expect(page).to have_content 'runner-active'
expect(page).not_to have_content 'runner-paused'
end
......@@ -68,7 +68,7 @@ describe "Admin Runners" do
visit admin_runners_path
input_filtered_search_keys('status=offline')
input_filtered_search_keys('status:=offline')
expect(page).not_to have_content 'runner-active'
expect(page).not_to have_content 'runner-paused'
......@@ -83,12 +83,12 @@ describe "Admin Runners" do
visit admin_runners_path
input_filtered_search_keys('status=active')
input_filtered_search_keys('status:=active')
expect(page).to have_content 'runner-a-1'
expect(page).to have_content 'runner-b-1'
expect(page).not_to have_content 'runner-a-2'
input_filtered_search_keys('status=active runner-a')
input_filtered_search_keys('status:=active runner-a')
expect(page).to have_content 'runner-a-1'
expect(page).not_to have_content 'runner-b-1'
expect(page).not_to have_content 'runner-a-2'
......@@ -105,7 +105,7 @@ describe "Admin Runners" do
expect(page).to have_content 'runner-project'
expect(page).to have_content 'runner-group'
input_filtered_search_keys('type=project_type')
input_filtered_search_keys('type:=project_type')
expect(page).to have_content 'runner-project'
expect(page).not_to have_content 'runner-group'
end
......@@ -116,7 +116,7 @@ describe "Admin Runners" do
visit admin_runners_path
input_filtered_search_keys('type=instance_type')
input_filtered_search_keys('type:=instance_type')
expect(page).not_to have_content 'runner-project'
expect(page).not_to have_content 'runner-group'
......@@ -131,12 +131,12 @@ describe "Admin Runners" do
visit admin_runners_path
input_filtered_search_keys('type=project_type')
input_filtered_search_keys('type:=project_type')
expect(page).to have_content 'runner-a-1'
expect(page).to have_content 'runner-b-1'
expect(page).not_to have_content 'runner-a-2'
input_filtered_search_keys('type=project_type runner-a')
input_filtered_search_keys('type:=project_type runner-a')
expect(page).to have_content 'runner-a-1'
expect(page).not_to have_content 'runner-b-1'
expect(page).not_to have_content 'runner-a-2'
......@@ -153,7 +153,7 @@ describe "Admin Runners" do
expect(page).to have_content 'runner-blue'
expect(page).to have_content 'runner-red'
input_filtered_search_keys('tag=blue')
input_filtered_search_keys('tag:=blue')
expect(page).to have_content 'runner-blue'
expect(page).not_to have_content 'runner-red'
......@@ -165,7 +165,7 @@ describe "Admin Runners" do
visit admin_runners_path
input_filtered_search_keys('tag=red')
input_filtered_search_keys('tag:=red')
expect(page).not_to have_content 'runner-blue'
expect(page).not_to have_content 'runner-blue'
......@@ -179,13 +179,13 @@ describe "Admin Runners" do
visit admin_runners_path
input_filtered_search_keys('tag=blue')
input_filtered_search_keys('tag:=blue')
expect(page).to have_content 'runner-a-1'
expect(page).to have_content 'runner-b-1'
expect(page).not_to have_content 'runner-a-2'
input_filtered_search_keys('tag=blue runner-a')
input_filtered_search_keys('tag:=blue runner-a')
expect(page).to have_content 'runner-a-1'
expect(page).not_to have_content 'runner-b-1'
......
......@@ -624,7 +624,7 @@ describe 'Issue Boards', :js do
end
def set_filter(type, text)
find('.filtered-search').native.send_keys("#{type}=#{text}")
find('.filtered-search').native.send_keys("#{type}:=#{text}")
end
def submit_filter
......
......@@ -211,7 +211,7 @@ describe 'Issue Boards add issue modal filtering', :js do
end
def set_filter(type, text = '')
find('.add-issues-modal .filtered-search').native.send_keys("#{type}=#{text}")
find('.add-issues-modal .filtered-search').native.send_keys("#{type}:=#{text}")
end
def submit_filter
......
......@@ -28,14 +28,14 @@ describe 'Dashboard Issues filtering', :js do
context 'filtering by milestone' do
it 'shows all issues with no milestone' do
input_filtered_search("milestone=none")
input_filtered_search("milestone:=none")
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_selector('.issue', count: 1)
end
it 'shows all issues with the selected milestone' do
input_filtered_search("milestone=%\"#{milestone.title}\"")
input_filtered_search("milestone:=%\"#{milestone.title}\"")
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_selector('.issue', count: 1)
......@@ -63,7 +63,7 @@ describe 'Dashboard Issues filtering', :js do
let!(:label_link) { create(:label_link, label: label, target: issue) }
it 'shows all issues with the selected label' do
input_filtered_search("label=~#{label.title}")
input_filtered_search("label:=~#{label.title}")
page.within 'ul.content-list' do
expect(page).to have_content issue.title
......
......@@ -30,7 +30,7 @@ RSpec.describe 'Dashboard Issues' do
it 'shows issues when current user is author', :js do
reset_filters
input_filtered_search("author=#{current_user.to_reference}")
input_filtered_search("author:=#{current_user.to_reference}")
expect(page).to have_content(authored_issue.title)
expect(page).to have_content(authored_issue_on_public_project.title)
......
......@@ -107,7 +107,7 @@ describe 'Dashboard Merge Requests' do
it 'shows authored merge requests', :js do
reset_filters
input_filtered_search("author=#{current_user.to_reference}")
input_filtered_search("author:=#{current_user.to_reference}")
expect(page).to have_content(authored_merge_request.title)
expect(page).to have_content(authored_merge_request_from_fork.title)
......@@ -120,7 +120,7 @@ describe 'Dashboard Merge Requests' do
it 'shows labeled merge requests', :js do
reset_filters
input_filtered_search("label=#{label.name}")
input_filtered_search("label:=#{label.name}")
expect(page).to have_content(labeled_merge_request.title)
......
......@@ -48,7 +48,7 @@ describe 'Group issues page' do
let(:user2) { user_outside_group }
it 'filters by only group users' do
filtered_search.set('assignee=')
filtered_search.set('assignee:=')
expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name)
expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name)
......
......@@ -52,7 +52,7 @@ describe 'Group merge requests page' do
let(:user2) { user_outside_group }
it 'filters by assignee only group users' do
filtered_search.set('assignee=')
filtered_search.set('assignee:=')
expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name)
expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name)
......
......@@ -20,13 +20,13 @@ describe 'Dropdown assignee', :js do
describe 'behavior' do
it 'loads all the assignees when opened' do
input_filtered_search('assignee=', submit: false, extra_space: false)
input_filtered_search('assignee:=', submit: false, extra_space: false)
expect_filtered_search_dropdown_results(filter_dropdown, 2)
end
it 'shows current user at top of dropdown' do
input_filtered_search('assignee=', submit: false, extra_space: false)
input_filtered_search('assignee:=', submit: false, extra_space: false)
expect(filter_dropdown.first('.filter-dropdown-item')).to have_content(user.name)
end
......@@ -35,7 +35,7 @@ describe 'Dropdown assignee', :js do
describe 'selecting from dropdown without Ajax call' do
before do
Gitlab::Testing::RequestBlockerMiddleware.block_requests!
input_filtered_search('assignee=', submit: false, extra_space: false)
input_filtered_search('assignee:=', submit: false, extra_space: false)
end
after do
......
......@@ -20,13 +20,13 @@ describe 'Dropdown author', :js do
describe 'behavior' do
it 'loads all the authors when opened' do
input_filtered_search('author=', submit: false, extra_space: false)
input_filtered_search('author:=', submit: false, extra_space: false)
expect_filtered_search_dropdown_results(filter_dropdown, 2)
end
it 'shows current user at top of dropdown' do
input_filtered_search('author=', submit: false, extra_space: false)
input_filtered_search('author:=', submit: false, extra_space: false)
expect(filter_dropdown.first('.filter-dropdown-item')).to have_content(user.name)
end
......@@ -35,7 +35,7 @@ describe 'Dropdown author', :js do
describe 'selecting from dropdown without Ajax call' do
before do
Gitlab::Testing::RequestBlockerMiddleware.block_requests!
input_filtered_search('author=', submit: false, extra_space: false)
input_filtered_search('author:=', submit: false, extra_space: false)
end
after do
......
......@@ -27,14 +27,14 @@ describe 'Dropdown base', :js do
it 'shows loading indicator when opened' do
slow_requests do
# We aren't using `input_filtered_search` because we want to see the loading indicator
filtered_search.set('assignee=')
filtered_search.set('assignee:=')
expect(page).to have_css("#{js_dropdown_assignee} .filter-dropdown-loading", visible: true)
end
end
it 'hides loading indicator when loaded' do
input_filtered_search('assignee=', submit: false, extra_space: false)
input_filtered_search('assignee:=', submit: false, extra_space: false)
expect(find(js_dropdown_assignee)).not_to have_css('.filter-dropdown-loading')
end
......@@ -42,7 +42,7 @@ describe 'Dropdown base', :js do
describe 'caching requests' do
it 'caches requests after the first load' do
input_filtered_search('assignee=', submit: false, extra_space: false)
input_filtered_search('assignee:=', submit: false, extra_space: false)
initial_size = dropdown_assignee_size
expect(initial_size).to be > 0
......@@ -50,7 +50,7 @@ describe 'Dropdown base', :js do
new_user = create(:user)
project.add_maintainer(new_user)
find('.filtered-search-box .clear-search').click
input_filtered_search('assignee=', submit: false, extra_space: false)
input_filtered_search('assignee:=', submit: false, extra_space: false)
expect(dropdown_assignee_size).to eq(initial_size)
end
......
......@@ -43,19 +43,19 @@ describe 'Dropdown emoji', :js do
describe 'behavior' do
it 'opens when the search bar has my-reaction=' do
filtered_search.set('my-reaction=')
filtered_search.set('my-reaction:=')
expect(page).to have_css(js_dropdown_emoji, visible: true)
end
it 'loads all the emojis when opened' do
input_filtered_search('my-reaction=', submit: false, extra_space: false)
input_filtered_search('my-reaction:=', submit: false, extra_space: false)
expect_filtered_search_dropdown_results(filter_dropdown, 3)
end
it 'shows the most populated emoji at top of dropdown' do
input_filtered_search('my-reaction=', submit: false, extra_space: false)
input_filtered_search('my-reaction:=', submit: false, extra_space: false)
expect(first("#{js_dropdown_emoji} .filter-dropdown li")).to have_content(award_emoji_star.name)
end
......
......@@ -21,7 +21,7 @@ describe 'Dropdown label', :js do
describe 'behavior' do
it 'loads all the labels when opened' do
create(:label, project: project, title: 'bug-label')
filtered_search.set('label=')
filtered_search.set('label:=')
expect_filtered_search_dropdown_results(filter_dropdown, 1)
end
......
......@@ -23,7 +23,7 @@ describe 'Dropdown milestone', :js do
describe 'behavior' do
before do
filtered_search.set('milestone=')
filtered_search.set('milestone:=')
end
it 'loads all the milestones when opened' do
......
......@@ -23,7 +23,7 @@ describe 'Dropdown release', :js do
describe 'behavior' do
before do
filtered_search.set('release=')
filtered_search.set('release:=')
end
it 'loads all the releases when opened' do
......
......@@ -36,7 +36,7 @@ describe 'Visual tokens', :js do
describe 'editing a single token' do
before do
input_filtered_search('author=@root assignee=none', submit: false)
input_filtered_search('author:=@root assignee:=none', submit: false)
first('.tokens-container .filtered-search-token').click
wait_for_requests
end
......@@ -77,7 +77,7 @@ describe 'Visual tokens', :js do
describe 'editing multiple tokens' do
before do
input_filtered_search('author=@root assignee=none', submit: false)
input_filtered_search('author:=@root assignee:=none', submit: false)
first('.tokens-container .filtered-search-token').click
end
......@@ -93,7 +93,7 @@ describe 'Visual tokens', :js do
describe 'editing a search term while editing another filter token' do
before do
input_filtered_search('foo assignee=', submit: false)
input_filtered_search('foo assignee:=', submit: false)
first('.tokens-container .filtered-search-term').click
end
......@@ -112,7 +112,7 @@ describe 'Visual tokens', :js do
describe 'add new token after editing existing token' do
before do
input_filtered_search('author=@root assignee=none', submit: false)
input_filtered_search('author:=@root assignee:=none', submit: false)
first('.tokens-container .filtered-search-token').double_click
filtered_search.send_keys(' ')
end
......@@ -123,7 +123,7 @@ describe 'Visual tokens', :js do
end
it 'opens token dropdown' do
filtered_search.send_keys('author=')
filtered_search.send_keys('author:=')
expect(page).to have_css('#js-dropdown-author', visible: true)
end
......@@ -131,7 +131,7 @@ describe 'Visual tokens', :js do
describe 'visual tokens' do
it 'creates visual token' do
filtered_search.send_keys('author=@thomas ')
filtered_search.send_keys('author:=@thomas ')
token = page.all('.tokens-container .filtered-search-token')[1]
expect(token.find('.name').text).to eq('Author')
......@@ -140,7 +140,7 @@ describe 'Visual tokens', :js do
end
it 'does not tokenize incomplete token' do
filtered_search.send_keys('author=')
filtered_search.send_keys('author:=')
find('body').click
token = page.all('.tokens-container .js-visual-token')[1]
......@@ -152,7 +152,7 @@ describe 'Visual tokens', :js do
describe 'search using incomplete visual tokens' do
before do
input_filtered_search('author=@root assignee=none', extra_space: false)
input_filtered_search('author:=@root assignee:=none', extra_space: false)
end
it 'tokenizes the search term to complete visual token' do
......
......@@ -23,7 +23,7 @@ describe 'Merge Requests > Filters generic behavior', :js do
context 'when filtered by a label' do
before do
input_filtered_search('label=~bug')
input_filtered_search('label:=~bug')
end
describe 'state tabs' do
......
......@@ -18,7 +18,7 @@ describe 'Merge Requests > User filters by assignees', :js do
context 'filtering by assignee:none' do
it 'applies the filter' do
input_filtered_search('assignee=none')
input_filtered_search('assignee:=none')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).not_to have_content 'Bugfix1'
......@@ -28,7 +28,7 @@ describe 'Merge Requests > User filters by assignees', :js do
context 'filtering by assignee=@username' do
it 'applies the filter' do
input_filtered_search("assignee=@#{user.username}")
input_filtered_search("assignee:=@#{user.username}")
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_content 'Bugfix1'
......
......@@ -22,7 +22,7 @@ describe 'Merge Requests > User filters by labels', :js do
context 'filtering by label:none' do
it 'applies the filter' do
input_filtered_search('label=none')
input_filtered_search('label:=none')
expect(page).to have_issuable_counts(open: 0, closed: 0, all: 0)
expect(page).not_to have_content 'Bugfix1'
......@@ -32,7 +32,7 @@ describe 'Merge Requests > User filters by labels', :js do
context 'filtering by label:~enhancement' do
it 'applies the filter' do
input_filtered_search('label=~enhancement')
input_filtered_search('label:=~enhancement')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_content 'Bugfix2'
......@@ -42,7 +42,7 @@ describe 'Merge Requests > User filters by labels', :js do
context 'filtering by label:~enhancement and label:~bug' do
it 'applies the filters' do
input_filtered_search('label=~bug label=~enhancement')
input_filtered_search('label:=~bug label:=~enhancement')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_content 'Bugfix2'
......
......@@ -18,14 +18,14 @@ describe 'Merge Requests > User filters by milestones', :js do
end
it 'filters by no milestone' do
input_filtered_search('milestone=none')
input_filtered_search('milestone:=none')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_css('.merge-request', count: 1)
end
it 'filters by a specific milestone' do
input_filtered_search("milestone=%'#{milestone.title}'")
input_filtered_search("milestone:=%'#{milestone.title}'")
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_css('.merge-request', count: 1)
......@@ -33,7 +33,7 @@ describe 'Merge Requests > User filters by milestones', :js do
describe 'filters by upcoming milestone' do
it 'does not show merge requests with no expiry' do
input_filtered_search('milestone=upcoming')
input_filtered_search('milestone:=upcoming')
expect(page).to have_issuable_counts(open: 0, closed: 0, all: 0)
expect(page).to have_css('.merge-request', count: 0)
......@@ -43,7 +43,7 @@ describe 'Merge Requests > User filters by milestones', :js do
let(:milestone) { create(:milestone, project: project, due_date: Date.tomorrow) }
it 'shows merge requests' do
input_filtered_search('milestone=upcoming')
input_filtered_search('milestone:=upcoming')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_css('.merge-request', count: 1)
......@@ -54,7 +54,7 @@ describe 'Merge Requests > User filters by milestones', :js do
let(:milestone) { create(:milestone, project: project, due_date: Date.yesterday) }
it 'does not show any merge requests' do
input_filtered_search('milestone=upcoming')
input_filtered_search('milestone:=upcoming')
expect(page).to have_issuable_counts(open: 0, closed: 0, all: 0)
expect(page).to have_css('.merge-request', count: 0)
......
......@@ -20,7 +20,7 @@ describe 'Merge requests > User filters by multiple criteria', :js do
describe 'filtering by label:~"Won\'t fix" and assignee:~bug' do
it 'applies the filters' do
input_filtered_search("label=~\"Won't fix\" assignee=@#{user.username}")
input_filtered_search("label:=~\"Won't fix\" assignee:=@#{user.username}")
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_content 'Bugfix2'
......@@ -30,7 +30,7 @@ describe 'Merge requests > User filters by multiple criteria', :js do
describe 'filtering by text, author, assignee, milestone, and label' do
it 'filters by text, author, assignee, milestone, and label' do
input_filtered_search_keys("author=@#{user.username} assignee=@#{user.username} milestone=%\"v1.1\" label=~\"Won't fix\" Bug")
input_filtered_search_keys("author:=@#{user.username} assignee:=@#{user.username} milestone:=%\"v1.1\" label:=~\"Won't fix\" Bug")
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_content 'Bugfix2'
......
......@@ -17,7 +17,7 @@ describe 'Merge Requests > User filters by target branch', :js do
context 'filtering by target-branch:master' do
it 'applies the filter' do
input_filtered_search('target-branch=master')
input_filtered_search('target-branch:=master')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_content mr1.title
......@@ -27,7 +27,7 @@ describe 'Merge Requests > User filters by target branch', :js do
context 'filtering by target-branch:merged-target' do
it 'applies the filter' do
input_filtered_search('target-branch=merged-target')
input_filtered_search('target-branch:=merged-target')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).not_to have_content mr1.title
......@@ -37,7 +37,7 @@ describe 'Merge Requests > User filters by target branch', :js do
context 'filtering by target-branch:feature' do
it 'applies the filter' do
input_filtered_search('target-branch=feature')
input_filtered_search('target-branch:=feature')
expect(page).to have_issuable_counts(open: 0, closed: 0, all: 0)
expect(page).not_to have_content mr1.title
......
......@@ -26,7 +26,7 @@ module FilteredSearchHelpers
# Select a label clicking in the search dropdown instead
# of entering label names on the input.
def select_label_on_dropdown(label_title)
input_filtered_search("label=", submit: false)
input_filtered_search("label:=", submit: false)
within('#js-dropdown-label') do
wait_for_requests
......@@ -71,7 +71,7 @@ module FilteredSearchHelpers
end
def init_label_search
filtered_search.set('label=')
filtered_search.set('label:=')
# This ensures the dropdown is shown
expect(find('#js-dropdown-label')).not_to have_css('.filter-dropdown-loading')
end
......
......@@ -13,7 +13,7 @@ RSpec.shared_examples 'issuable user dropdown behaviors' do
it 'only includes members of the project/group' do
visit issuables_path
filtered_search.set("#{dropdown}=")
filtered_search.set("#{dropdown}:=")
expect(find("#js-dropdown-#{dropdown} .filter-dropdown")).to have_content(user_in_dropdown.name)
expect(find("#js-dropdown-#{dropdown} .filter-dropdown")).not_to have_content(user_not_in_dropdown.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