Commit 21a638e8 authored by Rajat Jain's avatar Rajat Jain

Fix filtered search tokenization

parent 062dcdf9
......@@ -24,10 +24,12 @@ export default class DropdownOperator extends FilteredSearchDropdown {
if (selected.tagName === 'LI') {
if (selected.hasAttribute('data-value')) {
const name = FilteredSearchVisualTokens.getLastTokenPartial();
const operator = selected.dataset.value;
FilteredSearchVisualTokens.removeLastTokenPartial();
FilteredSearchDropdownManager.addWordToInput({
tokenName: this.filter,
tokenName: name,
tokenOperator: operator,
clicked: false,
});
......@@ -38,8 +40,6 @@ export default class DropdownOperator extends FilteredSearchDropdown {
}
renderContent(forceShowList = false) {
this.filter = FilteredSearchVisualTokens.getLastTokenPartial();
const dropdownData = [
{
tag: 'equal',
......
---
title: Fix filtered search tokenization
merge_request: 27648
author:
type: fixed
......@@ -162,4 +162,17 @@ describe 'Visual tokens', :js do
])
end
end
it 'does retain hint token when mix of typing and clicks are performed' do
input_filtered_search('label:', extra_space: false, submit: false)
expect(page).to have_css('#js-dropdown-operator', visible: true)
find('#js-dropdown-operator li[data-value="="]').click
token = page.all('.tokens-container .js-visual-token')[0]
expect(token.find('.name').text).to eq('Label')
expect(token.find('.operator').text).to eq('=')
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