summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Bahareth <omar@omar.engineer>2019-01-28 08:59:58 +0000
committerKushal Pandya <kushalspandya@gmail.com>2019-01-28 08:59:58 +0000
commit6e50b42ee80a7a98ef49ae9216fa8ab0fbe3e8b9 (patch)
tree8030a7ec5c77af71a69c207eb3853eb03336eabf
parentc2b3f64cb44114e69ddeeb453412ad4dd762baf9 (diff)
downloadgitlab-ce-6e50b42ee80a7a98ef49ae9216fa8ab0fbe3e8b9.tar.gz
Standardize token value capitalization in filter bar
-rw-r--r--app/assets/javascripts/filtered_search/filtered_search_manager.js2
-rw-r--r--app/assets/javascripts/filtered_search/filtered_search_token_keys.js6
-rw-r--r--app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js22
-rw-r--r--app/views/shared/issuable/_search_bar.html.haml20
-rw-r--r--changelogs/unreleased/54213-standardize-token-value-capitalization-in-filter-bar.yml5
-rw-r--r--spec/features/boards/modal_filter_spec.rb6
-rw-r--r--spec/features/issues/filtered_search/dropdown_assignee_spec.rb4
-rw-r--r--spec/features/issues/filtered_search/dropdown_emoji_spec.rb4
-rw-r--r--spec/features/issues/filtered_search/dropdown_label_spec.rb4
-rw-r--r--spec/features/issues/filtered_search/dropdown_milestone_spec.rb8
-rw-r--r--spec/features/issues/filtered_search/filter_issues_spec.rb10
-rw-r--r--spec/features/issues/filtered_search/visual_tokens_spec.rb6
12 files changed, 52 insertions, 45 deletions
diff --git a/app/assets/javascripts/filtered_search/filtered_search_manager.js b/app/assets/javascripts/filtered_search/filtered_search_manager.js
index 4a2af02b40a..33c82778c79 100644
--- a/app/assets/javascripts/filtered_search/filtered_search_manager.js
+++ b/app/assets/javascripts/filtered_search/filtered_search_manager.js
@@ -593,7 +593,7 @@ export default class FilteredSearchManager {
tokens.forEach(token => {
const condition = this.filteredSearchTokenKeys.searchByConditionKeyValue(
token.key,
- token.value.toLowerCase(),
+ token.value,
);
const tokenConfig = this.filteredSearchTokenKeys.searchByKey(token.key) || {};
const { param } = tokenConfig;
diff --git a/app/assets/javascripts/filtered_search/filtered_search_token_keys.js b/app/assets/javascripts/filtered_search/filtered_search_token_keys.js
index e01dedbb57c..b70da240833 100644
--- a/app/assets/javascripts/filtered_search/filtered_search_token_keys.js
+++ b/app/assets/javascripts/filtered_search/filtered_search_token_keys.js
@@ -65,8 +65,10 @@ export default class FilteredSearchTokenKeys {
searchByConditionKeyValue(key, value) {
return (
- this.conditions.find(condition => condition.tokenKey === key && condition.value === value) ||
- null
+ this.conditions.find(
+ condition =>
+ condition.tokenKey === key && condition.value.toLowerCase() === value.toLowerCase(),
+ ) || null
);
}
diff --git a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
index b494b7e2de0..fd61030eb13 100644
--- a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
+++ b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
@@ -60,52 +60,52 @@ export const conditions = [
{
url: 'assignee_id=None',
tokenKey: 'assignee',
- value: 'none',
+ value: 'None',
},
{
url: 'assignee_id=Any',
tokenKey: 'assignee',
- value: 'any',
+ value: 'Any',
},
{
url: 'milestone_title=None',
tokenKey: 'milestone',
- value: 'none',
+ value: 'None',
},
{
url: 'milestone_title=Any',
tokenKey: 'milestone',
- value: 'any',
+ value: 'Any',
},
{
url: 'milestone_title=%23upcoming',
tokenKey: 'milestone',
- value: 'upcoming',
+ value: 'Upcoming',
},
{
url: 'milestone_title=%23started',
tokenKey: 'milestone',
- value: 'started',
+ value: 'Started',
},
{
url: 'label_name[]=None',
tokenKey: 'label',
- value: 'none',
+ value: 'None',
},
{
url: 'label_name[]=Any',
- tokenKey: 'any',
- value: 'any',
+ tokenKey: 'label',
+ value: 'Any',
},
{
url: 'my_reaction_emoji=None',
tokenKey: 'my-reaction',
- value: 'none',
+ value: 'None',
},
{
url: 'my_reaction_emoji=Any',
tokenKey: 'my-reaction',
- value: 'any',
+ value: 'Any',
},
];
diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml
index 20847378495..588659c7e9c 100644
--- a/app/views/shared/issuable/_search_bar.html.haml
+++ b/app/views/shared/issuable/_search_bar.html.haml
@@ -57,10 +57,10 @@
avatar: { lazy: true, url: '{{avatar_url}}' }
#js-dropdown-assignee.filtered-search-input-dropdown-menu.dropdown-menu
%ul{ data: { dropdown: true } }
- %li.filter-dropdown-item{ data: { value: 'none' } }
+ %li.filter-dropdown-item{ data: { value: 'None' } }
%button.btn.btn-link{ type: 'button' }
= _('None')
- %li.filter-dropdown-item{ data: { value: 'any' } }
+ %li.filter-dropdown-item{ data: { value: 'Any' } }
%button.btn.btn-link{ type: 'button' }
= _('Any')
%li.divider.droplab-item-ignore
@@ -73,16 +73,16 @@
avatar: { lazy: true, url: '{{avatar_url}}' }
#js-dropdown-milestone.filtered-search-input-dropdown-menu.dropdown-menu
%ul{ data: { dropdown: true } }
- %li.filter-dropdown-item{ data: { value: 'none' } }
+ %li.filter-dropdown-item{ data: { value: 'None' } }
%button.btn.btn-link{ type: 'button' }
= _('None')
- %li.filter-dropdown-item{ data: { value: 'any' } }
+ %li.filter-dropdown-item{ data: { value: 'Any' } }
%button.btn.btn-link{ type: 'button' }
= _('Any')
- %li.filter-dropdown-item{ data: { value: 'upcoming' } }
+ %li.filter-dropdown-item{ data: { value: 'Upcoming' } }
%button.btn.btn-link{ type: 'button' }
= _('Upcoming')
- %li.filter-dropdown-item{ data: { value: 'started' } }
+ %li.filter-dropdown-item{ data: { value: 'Started' } }
%button.btn.btn-link{ type: 'button' }
= _('Started')
%li.divider.droplab-item-ignore
@@ -92,10 +92,10 @@
{{title}}
#js-dropdown-label.filtered-search-input-dropdown-menu.dropdown-menu
%ul{ data: { dropdown: true } }
- %li.filter-dropdown-item{ data: { value: 'none' } }
+ %li.filter-dropdown-item{ data: { value: 'None' } }
%button.btn.btn-link{ type: 'button' }
= _('None')
- %li.filter-dropdown-item{ data: { value: 'any' } }
+ %li.filter-dropdown-item{ data: { value: 'Any' } }
%button.btn.btn-link{ type: 'button' }
= _('Any')
%li.divider.droplab-item-ignore
@@ -107,10 +107,10 @@
{{title}}
#js-dropdown-my-reaction.filtered-search-input-dropdown-menu.dropdown-menu
%ul{ data: { dropdown: true } }
- %li.filter-dropdown-item{ data: { value: 'none' } }
+ %li.filter-dropdown-item{ data: { value: 'None' } }
%button.btn.btn-link{ type: 'button' }
= _('None')
- %li.filter-dropdown-item{ data: { value: 'any' } }
+ %li.filter-dropdown-item{ data: { value: 'Any' } }
%button.btn.btn-link{ type: 'button' }
= _('Any')
%li.divider.droplab-item-ignore
diff --git a/changelogs/unreleased/54213-standardize-token-value-capitalization-in-filter-bar.yml b/changelogs/unreleased/54213-standardize-token-value-capitalization-in-filter-bar.yml
new file mode 100644
index 00000000000..37dea77b8d2
--- /dev/null
+++ b/changelogs/unreleased/54213-standardize-token-value-capitalization-in-filter-bar.yml
@@ -0,0 +1,5 @@
+---
+title: Standardize filter value capitlization in filter bar in both issues and boards pages
+merge_request: 23846
+author: obahareth
+type: changed
diff --git a/spec/features/boards/modal_filter_spec.rb b/spec/features/boards/modal_filter_spec.rb
index d96707e55fd..e42d18b457e 100644
--- a/spec/features/boards/modal_filter_spec.rb
+++ b/spec/features/boards/modal_filter_spec.rb
@@ -112,7 +112,7 @@ describe 'Issue Boards add issue modal filtering', :js do
page.within('.add-issues-modal') do
wait_for_requests
- expect(page).to have_selector('.js-visual-token', text: 'none')
+ expect(page).to have_selector('.js-visual-token', text: 'None')
expect(page).to have_selector('.board-card', count: 1)
end
end
@@ -147,7 +147,7 @@ describe 'Issue Boards add issue modal filtering', :js do
page.within('.add-issues-modal') do
wait_for_requests
- expect(page).to have_selector('.js-visual-token', text: 'upcoming')
+ expect(page).to have_selector('.js-visual-token', text: 'Upcoming')
expect(page).to have_selector('.board-card', count: 0)
end
end
@@ -182,7 +182,7 @@ describe 'Issue Boards add issue modal filtering', :js do
page.within('.add-issues-modal') do
wait_for_requests
- expect(page).to have_selector('.js-visual-token', text: 'none')
+ expect(page).to have_selector('.js-visual-token', text: 'None')
expect(page).to have_selector('.board-card', count: 1)
end
end
diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb
index e910fb54d23..00c88c61538 100644
--- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb
@@ -160,7 +160,7 @@ describe 'Dropdown assignee', :js do
find('#js-dropdown-assignee .filter-dropdown-item', text: 'None').click
expect(page).to have_css(js_dropdown_assignee, visible: false)
- expect_tokens([assignee_token('none')])
+ expect_tokens([assignee_token('None')])
expect_filtered_search_input_empty
end
@@ -168,7 +168,7 @@ describe 'Dropdown assignee', :js do
find('#js-dropdown-assignee .filter-dropdown-item', text: 'Any').click
expect(page).to have_css(js_dropdown_assignee, visible: false)
- expect_tokens([assignee_token('any')])
+ expect_tokens([assignee_token('Any')])
expect_filtered_search_input_empty
end
end
diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb
index 97dd0afd002..2ba0fc08c2c 100644
--- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb
@@ -125,7 +125,7 @@ describe 'Dropdown emoji', :js do
find('#js-dropdown-my-reaction .filter-dropdown-item', text: 'None').click
expect(page).to have_css(js_dropdown_emoji, visible: false)
- expect_tokens([reaction_token('none', false)])
+ expect_tokens([reaction_token('None', false)])
expect_filtered_search_input_empty
end
@@ -133,7 +133,7 @@ describe 'Dropdown emoji', :js do
find('#js-dropdown-my-reaction .filter-dropdown-item', text: 'Any').click
expect(page).to have_css(js_dropdown_emoji, visible: false)
- expect_tokens([reaction_token('any', false)])
+ expect_tokens([reaction_token('Any', false)])
expect_filtered_search_input_empty
end
diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb
index b25b1514d62..f502061dfce 100644
--- a/spec/features/issues/filtered_search/dropdown_label_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb
@@ -238,7 +238,7 @@ describe 'Dropdown label', :js do
find("#{js_dropdown_label} .filter-dropdown-item", text: 'None').click
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([label_token('none', false)])
+ expect_tokens([label_token('None', false)])
expect_filtered_search_input_empty
end
@@ -246,7 +246,7 @@ describe 'Dropdown label', :js do
find("#{js_dropdown_label} .filter-dropdown-item", text: 'Any').click
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([label_token('any', false)])
+ expect_tokens([label_token('Any', false)])
expect_filtered_search_input_empty
end
end
diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb
index ef5801e61e8..e651e83ada3 100644
--- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb
@@ -192,7 +192,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone('None')
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([milestone_token('none', false)])
+ expect_tokens([milestone_token('None', false)])
expect_filtered_search_input_empty
end
@@ -200,7 +200,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone('Any')
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([milestone_token('any', false)])
+ expect_tokens([milestone_token('Any', false)])
expect_filtered_search_input_empty
end
@@ -208,7 +208,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone('Upcoming')
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([milestone_token('upcoming', false)])
+ expect_tokens([milestone_token('Upcoming', false)])
expect_filtered_search_input_empty
end
@@ -216,7 +216,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone('Started')
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([milestone_token('started', false)])
+ expect_tokens([milestone_token('Started', false)])
expect_filtered_search_input_empty
end
end
diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb
index a29380a180e..fa8e5cb0ca9 100644
--- a/spec/features/issues/filtered_search/filter_issues_spec.rb
+++ b/spec/features/issues/filtered_search/filter_issues_spec.rb
@@ -108,7 +108,7 @@ describe 'Filter issues', :js do
it 'filters issues by no assignee' do
input_filtered_search('assignee:none')
- expect_tokens([assignee_token('none')])
+ expect_tokens([assignee_token('None')])
expect_issues_list_count(3)
expect_filtered_search_input_empty
end
@@ -146,7 +146,7 @@ describe 'Filter issues', :js do
it 'filters issues by no label' do
input_filtered_search('label:none')
- expect_tokens([label_token('none', false)])
+ expect_tokens([label_token('None', false)])
expect_issues_list_count(4)
expect_filtered_search_input_empty
end
@@ -287,7 +287,7 @@ describe 'Filter issues', :js do
it 'filters issues by no milestone' do
input_filtered_search("milestone:none")
- expect_tokens([milestone_token('none', false)])
+ expect_tokens([milestone_token('None', false)])
expect_issues_list_count(3)
expect_filtered_search_input_empty
end
@@ -299,7 +299,7 @@ describe 'Filter issues', :js do
input_filtered_search("milestone:upcoming")
- expect_tokens([milestone_token('upcoming', false)])
+ expect_tokens([milestone_token('Upcoming', false)])
expect_issues_list_count(1)
expect_filtered_search_input_empty
end
@@ -307,7 +307,7 @@ describe 'Filter issues', :js do
it 'filters issues by started milestones' do
input_filtered_search("milestone:started")
- expect_tokens([milestone_token('started', false)])
+ expect_tokens([milestone_token('Started', false)])
expect_issues_list_count(5)
expect_filtered_search_input_empty
end
diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb
index 1e1dd5691ab..a4c34ce85f0 100644
--- a/spec/features/issues/filtered_search/visual_tokens_spec.rb
+++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb
@@ -122,7 +122,7 @@ describe 'Visual tokens', :js do
end
it 'changes value in visual token' do
- expect(first('.tokens-container .filtered-search-token .value').text).to eq('none')
+ expect(first('.tokens-container .filtered-search-token .value').text).to eq('None')
end
it 'moves input to the right' do
@@ -147,7 +147,7 @@ describe 'Visual tokens', :js do
it 'selects static option from dropdown' do
find("#js-dropdown-milestone").find('.filter-dropdown-item', text: 'Upcoming').click
- expect(first('.tokens-container .filtered-search-token .value').text).to eq('upcoming')
+ expect(first('.tokens-container .filtered-search-token .value').text).to eq('Upcoming')
expect(is_input_focused).to eq(true)
end
@@ -348,7 +348,7 @@ describe 'Visual tokens', :js do
it 'tokenizes the search term to complete visual token' do
expect_tokens([
author_token(user.name),
- assignee_token('none')
+ assignee_token('None')
])
end
end