Commit ce9d3ee5 authored by Clement Ho's avatar Clement Ho

Backend review

parent 044a195b
...@@ -22,7 +22,8 @@ require('../window')(function(w){ ...@@ -22,7 +22,8 @@ require('../window')(function(w){
debounceTrigger: function debounceTrigger(e) { debounceTrigger: function debounceTrigger(e) {
var NON_CHARACTER_KEYS = [16, 17, 18, 20, 37, 38, 39, 40, 91, 93]; var NON_CHARACTER_KEYS = [16, 17, 18, 20, 37, 38, 39, 40, 91, 93];
var invalidKeyPressed = NON_CHARACTER_KEYS.indexOf(e.detail.which || e.detail.keyCode) > -1; var invalidKeyPressed = NON_CHARACTER_KEYS.indexOf(e.detail.which || e.detail.keyCode) > -1;
var focusEvent = false; var focusEvent = e.type === 'focus';
if (invalidKeyPressed || this.loading) { if (invalidKeyPressed || this.loading) {
return; return;
} }
...@@ -31,10 +32,6 @@ require('../window')(function(w){ ...@@ -31,10 +32,6 @@ require('../window')(function(w){
clearTimeout(this.timeout); clearTimeout(this.timeout);
} }
if (e.type === 'focus') {
focusEvent = true;
}
this.timeout = setTimeout(this.trigger.bind(this, focusEvent), 200); this.timeout = setTimeout(this.trigger.bind(this, focusEvent), 200);
}, },
...@@ -66,7 +63,7 @@ require('../window')(function(w){ ...@@ -66,7 +63,7 @@ require('../window')(function(w){
searchValue = ''; searchValue = '';
} }
if (searchValue === config.searchKey) { if (config.searchKey === searchValue) {
return this.list.show(); return this.list.show();
} }
......
...@@ -39,26 +39,31 @@ describe 'Dropdown assignee', js: true, feature: true do ...@@ -39,26 +39,31 @@ describe 'Dropdown assignee', js: true, feature: true do
describe 'behavior' do describe 'behavior' do
it 'opens when the search bar has assignee:' do it 'opens when the search bar has assignee:' do
filtered_search.set('assignee:') filtered_search.set('assignee:')
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
it 'closes when the search bar is unfocused' do it 'closes when the search bar is unfocused' do
find('body').click() find('body').click()
expect(page).to have_css(js_dropdown_assignee, visible: false) expect(page).to have_css(js_dropdown_assignee, visible: false)
end end
it 'should show loading indicator when opened' do it 'should show loading indicator when opened' do
filtered_search.set('assignee:') filtered_search.set('assignee:')
expect(page).to have_css('#js-dropdown-assignee .filter-dropdown-loading', visible: true) expect(page).to have_css('#js-dropdown-assignee .filter-dropdown-loading', visible: true)
end end
it 'should hide loading indicator when loaded' do it 'should hide loading indicator when loaded' do
send_keys_to_filtered_search('assignee:') send_keys_to_filtered_search('assignee:')
expect(page).not_to have_css('#js-dropdown-assignee .filter-dropdown-loading') expect(page).not_to have_css('#js-dropdown-assignee .filter-dropdown-loading')
end end
it 'should load all the assignees when opened' do it 'should load all the assignees when opened' do
send_keys_to_filtered_search('assignee:') send_keys_to_filtered_search('assignee:')
expect(dropdown_assignee_size).to eq(3) expect(dropdown_assignee_size).to eq(3)
end end
end end
...@@ -70,31 +75,37 @@ describe 'Dropdown assignee', js: true, feature: true do ...@@ -70,31 +75,37 @@ describe 'Dropdown assignee', js: true, feature: true do
it 'filters by name' do it 'filters by name' do
send_keys_to_filtered_search('j') send_keys_to_filtered_search('j')
expect(dropdown_assignee_size).to eq(2) expect(dropdown_assignee_size).to eq(2)
end end
it 'filters by case insensitive name' do it 'filters by case insensitive name' do
send_keys_to_filtered_search('J') send_keys_to_filtered_search('J')
expect(dropdown_assignee_size).to eq(2) expect(dropdown_assignee_size).to eq(2)
end end
it 'filters by username with symbol' do it 'filters by username with symbol' do
send_keys_to_filtered_search('@ot') send_keys_to_filtered_search('@ot')
expect(dropdown_assignee_size).to eq(2) expect(dropdown_assignee_size).to eq(2)
end end
it 'filters by case insensitive username with symbol' do it 'filters by case insensitive username with symbol' do
send_keys_to_filtered_search('@OT') send_keys_to_filtered_search('@OT')
expect(dropdown_assignee_size).to eq(2) expect(dropdown_assignee_size).to eq(2)
end end
it 'filters by username without symbol' do it 'filters by username without symbol' do
send_keys_to_filtered_search('ot') send_keys_to_filtered_search('ot')
expect(dropdown_assignee_size).to eq(2) expect(dropdown_assignee_size).to eq(2)
end end
it 'filters by case insensitive username without symbol' do it 'filters by case insensitive username without symbol' do
send_keys_to_filtered_search('OT') send_keys_to_filtered_search('OT')
expect(dropdown_assignee_size).to eq(2) expect(dropdown_assignee_size).to eq(2)
end end
end end
...@@ -106,6 +117,7 @@ describe 'Dropdown assignee', js: true, feature: true do ...@@ -106,6 +117,7 @@ describe 'Dropdown assignee', js: true, feature: true do
it 'fills in the assignee username when the assignee has not been filtered' do it 'fills in the assignee username when the assignee has not been filtered' do
click_assignee(user_jacob.name) click_assignee(user_jacob.name)
expect(page).to have_css(js_dropdown_assignee, visible: false) expect(page).to have_css(js_dropdown_assignee, visible: false)
expect(filtered_search.value).to eq("assignee:@#{user_jacob.username}") expect(filtered_search.value).to eq("assignee:@#{user_jacob.username}")
end end
...@@ -113,12 +125,14 @@ describe 'Dropdown assignee', js: true, feature: true do ...@@ -113,12 +125,14 @@ describe 'Dropdown assignee', js: true, feature: true do
it 'fills in the assignee username when the assignee has been filtered' do it 'fills in the assignee username when the assignee has been filtered' do
send_keys_to_filtered_search('roo') send_keys_to_filtered_search('roo')
click_assignee(user.name) click_assignee(user.name)
expect(page).to have_css(js_dropdown_assignee, visible: false) expect(page).to have_css(js_dropdown_assignee, visible: false)
expect(filtered_search.value).to eq("assignee:@#{user.username}") expect(filtered_search.value).to eq("assignee:@#{user.username}")
end end
it 'selects `no assignee`' do it 'selects `no assignee`' do
find('#js-dropdown-assignee .filter-dropdown-item', text: 'No Assignee').click find('#js-dropdown-assignee .filter-dropdown-item', text: 'No Assignee').click
expect(page).to have_css(js_dropdown_assignee, visible: false) expect(page).to have_css(js_dropdown_assignee, visible: false)
expect(filtered_search.value).to eq("assignee:none") expect(filtered_search.value).to eq("assignee:none")
end end
...@@ -127,21 +141,25 @@ describe 'Dropdown assignee', js: true, feature: true do ...@@ -127,21 +141,25 @@ describe 'Dropdown assignee', js: true, feature: true do
describe 'input has existing content' do describe 'input has existing content' do
it 'opens assignee dropdown with existing search term' do it 'opens assignee dropdown with existing search term' do
filtered_search.set('searchTerm assignee:') filtered_search.set('searchTerm assignee:')
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
it 'opens assignee dropdown with existing author' do it 'opens assignee dropdown with existing author' do
filtered_search.set('author:@user assignee:') filtered_search.set('author:@user assignee:')
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
it 'opens assignee dropdown with existing label' do it 'opens assignee dropdown with existing label' do
filtered_search.set('label:~bug assignee:') filtered_search.set('label:~bug assignee:')
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
it 'opens assignee dropdown with existing milestone' do it 'opens assignee dropdown with existing milestone' do
filtered_search.set('milestone:%v1.0 assignee:') filtered_search.set('milestone:%v1.0 assignee:')
expect(page).to have_css(js_dropdown_assignee, visible: true) expect(page).to have_css(js_dropdown_assignee, visible: true)
end end
end end
......
...@@ -39,26 +39,31 @@ describe 'Dropdown author', js: true, feature: true do ...@@ -39,26 +39,31 @@ describe 'Dropdown author', js: true, feature: true do
describe 'behavior' do describe 'behavior' do
it 'opens when the search bar has author:' do it 'opens when the search bar has author:' do
filtered_search.set('author:') filtered_search.set('author:')
expect(page).to have_css(js_dropdown_author, visible: true) expect(page).to have_css(js_dropdown_author, visible: true)
end end
it 'closes when the search bar is unfocused' do it 'closes when the search bar is unfocused' do
find('body').click() find('body').click()
expect(page).to have_css(js_dropdown_author, visible: false) expect(page).to have_css(js_dropdown_author, visible: false)
end end
it 'should show loading indicator when opened' do it 'should show loading indicator when opened' do
filtered_search.set('author:') filtered_search.set('author:')
expect(page).to have_css('#js-dropdown-author .filter-dropdown-loading', visible: true) expect(page).to have_css('#js-dropdown-author .filter-dropdown-loading', visible: true)
end end
it 'should hide loading indicator when loaded' do it 'should hide loading indicator when loaded' do
send_keys_to_filtered_search('author:') send_keys_to_filtered_search('author:')
expect(page).not_to have_css('#js-dropdown-author .filter-dropdown-loading') expect(page).not_to have_css('#js-dropdown-author .filter-dropdown-loading')
end end
it 'should load all the authors when opened' do it 'should load all the authors when opened' do
send_keys_to_filtered_search('author:') send_keys_to_filtered_search('author:')
expect(dropdown_author_size).to eq(3) expect(dropdown_author_size).to eq(3)
end end
end end
...@@ -71,26 +76,31 @@ describe 'Dropdown author', js: true, feature: true do ...@@ -71,26 +76,31 @@ describe 'Dropdown author', js: true, feature: true do
it 'filters by name' do it 'filters by name' do
send_keys_to_filtered_search('ja') send_keys_to_filtered_search('ja')
expect(dropdown_author_size).to eq(1) expect(dropdown_author_size).to eq(1)
end end
it 'filters by case insensitive name' do it 'filters by case insensitive name' do
send_keys_to_filtered_search('Ja') send_keys_to_filtered_search('Ja')
expect(dropdown_author_size).to eq(1) expect(dropdown_author_size).to eq(1)
end end
it 'filters by username with symbol' do it 'filters by username with symbol' do
send_keys_to_filtered_search('@ot') send_keys_to_filtered_search('@ot')
expect(dropdown_author_size).to eq(2) expect(dropdown_author_size).to eq(2)
end end
it 'filters by username without symbol' do it 'filters by username without symbol' do
send_keys_to_filtered_search('ot') send_keys_to_filtered_search('ot')
expect(dropdown_author_size).to eq(2) expect(dropdown_author_size).to eq(2)
end end
it 'filters by case insensitive username without symbol' do it 'filters by case insensitive username without symbol' do
send_keys_to_filtered_search('OT') send_keys_to_filtered_search('OT')
expect(dropdown_author_size).to eq(2) expect(dropdown_author_size).to eq(2)
end end
end end
...@@ -103,12 +113,14 @@ describe 'Dropdown author', js: true, feature: true do ...@@ -103,12 +113,14 @@ describe 'Dropdown author', js: true, feature: true do
it 'fills in the author username when the author has not been filtered' do it 'fills in the author username when the author has not been filtered' do
click_author(user_jacob.name) click_author(user_jacob.name)
expect(page).to have_css(js_dropdown_author, visible: false) expect(page).to have_css(js_dropdown_author, visible: false)
expect(filtered_search.value).to eq("author:@#{user_jacob.username}") expect(filtered_search.value).to eq("author:@#{user_jacob.username}")
end end
it 'fills in the author username when the author has been filtered' do it 'fills in the author username when the author has been filtered' do
click_author(user.name) click_author(user.name)
expect(page).to have_css(js_dropdown_author, visible: false) expect(page).to have_css(js_dropdown_author, visible: false)
expect(filtered_search.value).to eq("author:@#{user.username}") expect(filtered_search.value).to eq("author:@#{user.username}")
end end
...@@ -117,21 +129,25 @@ describe 'Dropdown author', js: true, feature: true do ...@@ -117,21 +129,25 @@ describe 'Dropdown author', js: true, feature: true do
describe 'input has existing content' do describe 'input has existing content' do
it 'opens author dropdown with existing search term' do it 'opens author dropdown with existing search term' do
filtered_search.set('searchTerm author:') filtered_search.set('searchTerm author:')
expect(page).to have_css(js_dropdown_author, visible: true) expect(page).to have_css(js_dropdown_author, visible: true)
end end
it 'opens author dropdown with existing assignee' do it 'opens author dropdown with existing assignee' do
filtered_search.set('assignee:@user author:') filtered_search.set('assignee:@user author:')
expect(page).to have_css(js_dropdown_author, visible: true) expect(page).to have_css(js_dropdown_author, visible: true)
end end
it 'opens author dropdown with existing label' do it 'opens author dropdown with existing label' do
filtered_search.set('label:~bug author:') filtered_search.set('label:~bug author:')
expect(page).to have_css(js_dropdown_author, visible: true) expect(page).to have_css(js_dropdown_author, visible: true)
end end
it 'opens author dropdown with existing milestone' do it 'opens author dropdown with existing milestone' do
filtered_search.set('milestone:%v1.0 author:') filtered_search.set('milestone:%v1.0 author:')
expect(page).to have_css(js_dropdown_author, visible: true) expect(page).to have_css(js_dropdown_author, visible: true)
end end
end end
......
...@@ -36,6 +36,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -36,6 +36,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'closes when the search bar is unfocused' do it 'closes when the search bar is unfocused' do
find('body').click find('body').click
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
end end
end end
...@@ -43,12 +44,14 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -43,12 +44,14 @@ describe 'Dropdown hint', js: true, feature: true do
describe 'filtering' do describe 'filtering' do
it 'does not filter `Keep typing and press Enter`' do it 'does not filter `Keep typing and press Enter`' do
filtered_search.set('randomtext') filtered_search.set('randomtext')
expect(page).to have_css(js_dropdown_hint, text: 'Keep typing and press Enter', visible: false) expect(page).to have_css(js_dropdown_hint, text: 'Keep typing and press Enter', visible: false)
expect(dropdown_hint_size).to eq(0) expect(dropdown_hint_size).to eq(0)
end end
it 'filters with text' do it 'filters with text' do
filtered_search.set('a') filtered_search.set('a')
expect(dropdown_hint_size).to eq(3) expect(dropdown_hint_size).to eq(3)
end end
end end
...@@ -60,6 +63,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -60,6 +63,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'opens the author dropdown when you click on author' do it 'opens the author dropdown when you click on author' do
click_hint('author') click_hint('author')
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-author', visible: true) expect(page).to have_css('#js-dropdown-author', visible: true)
expect(filtered_search.value).to eq('author:') expect(filtered_search.value).to eq('author:')
...@@ -67,6 +71,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -67,6 +71,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'opens the assignee dropdown when you click on assignee' do it 'opens the assignee dropdown when you click on assignee' do
click_hint('assignee') click_hint('assignee')
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-assignee', visible: true) expect(page).to have_css('#js-dropdown-assignee', visible: true)
expect(filtered_search.value).to eq('assignee:') expect(filtered_search.value).to eq('assignee:')
...@@ -74,6 +79,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -74,6 +79,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'opens the milestone dropdown when you click on milestone' do it 'opens the milestone dropdown when you click on milestone' do
click_hint('milestone') click_hint('milestone')
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-milestone', visible: true) expect(page).to have_css('#js-dropdown-milestone', visible: true)
expect(filtered_search.value).to eq('milestone:') expect(filtered_search.value).to eq('milestone:')
...@@ -81,6 +87,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -81,6 +87,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'opens the label dropdown when you click on label' do it 'opens the label dropdown when you click on label' do
click_hint('label') click_hint('label')
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-label', visible: true) expect(page).to have_css('#js-dropdown-label', visible: true)
expect(filtered_search.value).to eq('label:') expect(filtered_search.value).to eq('label:')
...@@ -91,6 +98,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -91,6 +98,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'opens the author dropdown when you click on author' do it 'opens the author dropdown when you click on author' do
filtered_search.set('auth') filtered_search.set('auth')
click_hint('author') click_hint('author')
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-author', visible: true) expect(page).to have_css('#js-dropdown-author', visible: true)
expect(filtered_search.value).to eq('author:') expect(filtered_search.value).to eq('author:')
...@@ -99,6 +107,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -99,6 +107,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'opens the assignee dropdown when you click on assignee' do it 'opens the assignee dropdown when you click on assignee' do
filtered_search.set('assign') filtered_search.set('assign')
click_hint('assignee') click_hint('assignee')
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-assignee', visible: true) expect(page).to have_css('#js-dropdown-assignee', visible: true)
expect(filtered_search.value).to eq('assignee:') expect(filtered_search.value).to eq('assignee:')
...@@ -107,6 +116,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -107,6 +116,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'opens the milestone dropdown when you click on milestone' do it 'opens the milestone dropdown when you click on milestone' do
filtered_search.set('mile') filtered_search.set('mile')
click_hint('milestone') click_hint('milestone')
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-milestone', visible: true) expect(page).to have_css('#js-dropdown-milestone', visible: true)
expect(filtered_search.value).to eq('milestone:') expect(filtered_search.value).to eq('milestone:')
...@@ -115,6 +125,7 @@ describe 'Dropdown hint', js: true, feature: true do ...@@ -115,6 +125,7 @@ describe 'Dropdown hint', js: true, feature: true do
it 'opens the label dropdown when you click on label' do it 'opens the label dropdown when you click on label' do
filtered_search.set('lab') filtered_search.set('lab')
click_hint('label') click_hint('label')
expect(page).to have_css(js_dropdown_hint, visible: false) expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-label', visible: true) expect(page).to have_css('#js-dropdown-label', visible: true)
expect(filtered_search.value).to eq('label:') expect(filtered_search.value).to eq('label:')
......
...@@ -43,26 +43,31 @@ describe 'Dropdown label', js: true, feature: true do ...@@ -43,26 +43,31 @@ describe 'Dropdown label', js: true, feature: true do
describe 'behavior' do describe 'behavior' do
it 'opens when the search bar has label:' do it 'opens when the search bar has label:' do
filtered_search.set('label:') filtered_search.set('label:')
expect(page).to have_css(js_dropdown_label, visible: true) expect(page).to have_css(js_dropdown_label, visible: true)
end end
it 'closes when the search bar is unfocused' do it 'closes when the search bar is unfocused' do
find('body').click() find('body').click()
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
end end
it 'should show loading indicator when opened' do it 'should show loading indicator when opened' do
filtered_search.set('label:') filtered_search.set('label:')
expect(page).to have_css('#js-dropdown-label .filter-dropdown-loading', visible: true) expect(page).to have_css('#js-dropdown-label .filter-dropdown-loading', visible: true)
end end
it 'should hide loading indicator when loaded' do it 'should hide loading indicator when loaded' do
send_keys_to_filtered_search('label:') send_keys_to_filtered_search('label:')
expect(page).not_to have_css('#js-dropdown-label .filter-dropdown-loading') expect(page).not_to have_css('#js-dropdown-label .filter-dropdown-loading')
end end
it 'should load all the labels when opened' do it 'should load all the labels when opened' do
send_keys_to_filtered_search('label:') send_keys_to_filtered_search('label:')
expect(dropdown_label_size).to be > 0 expect(dropdown_label_size).to be > 0
end end
end end
...@@ -74,61 +79,73 @@ describe 'Dropdown label', js: true, feature: true do ...@@ -74,61 +79,73 @@ describe 'Dropdown label', js: true, feature: true do
it 'filters by name' do it 'filters by name' do
send_keys_to_filtered_search(':b') send_keys_to_filtered_search(':b')
expect(dropdown_label_size).to eq(2) expect(dropdown_label_size).to eq(2)
end end
it 'filters by case insensitive name' do it 'filters by case insensitive name' do
send_keys_to_filtered_search(':B') send_keys_to_filtered_search(':B')
expect(dropdown_label_size).to eq(2) expect(dropdown_label_size).to eq(2)
end end
it 'filters by name with symbol' do it 'filters by name with symbol' do
send_keys_to_filtered_search(':~bu') send_keys_to_filtered_search(':~bu')
expect(dropdown_label_size).to eq(2) expect(dropdown_label_size).to eq(2)
end end
it 'filters by case insensitive name with symbol' do it 'filters by case insensitive name with symbol' do
send_keys_to_filtered_search(':~BU') send_keys_to_filtered_search(':~BU')
expect(dropdown_label_size).to eq(2) expect(dropdown_label_size).to eq(2)
end end
it 'filters by multiple words' do it 'filters by multiple words' do
send_keys_to_filtered_search(':Hig') send_keys_to_filtered_search(':Hig')
expect(dropdown_label_size).to eq(1) expect(dropdown_label_size).to eq(1)
end end
it 'filters by multiple words with symbol' do it 'filters by multiple words with symbol' do
send_keys_to_filtered_search(':~Hig') send_keys_to_filtered_search(':~Hig')
expect(dropdown_label_size).to eq(1) expect(dropdown_label_size).to eq(1)
end end
it 'filters by multiple words containing single quotes' do it 'filters by multiple words containing single quotes' do
send_keys_to_filtered_search(':won\'t') send_keys_to_filtered_search(':won\'t')
expect(dropdown_label_size).to eq(1) expect(dropdown_label_size).to eq(1)
end end
it 'filters by multiple words containing single quotes with symbol' do it 'filters by multiple words containing single quotes with symbol' do
send_keys_to_filtered_search(':~won\'t') send_keys_to_filtered_search(':~won\'t')
expect(dropdown_label_size).to eq(1) expect(dropdown_label_size).to eq(1)
end end
it 'filters by multiple words containing double quotes' do it 'filters by multiple words containing double quotes' do
send_keys_to_filtered_search(':won"t') send_keys_to_filtered_search(':won"t')
expect(dropdown_label_size).to eq(1) expect(dropdown_label_size).to eq(1)
end end
it 'filters by multiple words containing double quotes with symbol' do it 'filters by multiple words containing double quotes with symbol' do
send_keys_to_filtered_search(':~won"t') send_keys_to_filtered_search(':~won"t')
expect(dropdown_label_size).to eq(1) expect(dropdown_label_size).to eq(1)
end end
it 'filters by special characters' do it 'filters by special characters' do
send_keys_to_filtered_search(':^+') send_keys_to_filtered_search(':^+')
expect(dropdown_label_size).to eq(1) expect(dropdown_label_size).to eq(1)
end end
it 'filters by special characters with symbol' do it 'filters by special characters with symbol' do
send_keys_to_filtered_search(':~^+') send_keys_to_filtered_search(':~^+')
expect(dropdown_label_size).to eq(1) expect(dropdown_label_size).to eq(1)
end end
end end
...@@ -140,6 +157,7 @@ describe 'Dropdown label', js: true, feature: true do ...@@ -140,6 +157,7 @@ describe 'Dropdown label', js: true, feature: true do
it 'fills in the label name when the label has not been filled' do it 'fills in the label name when the label has not been filled' do
click_label(bug_label.title) click_label(bug_label.title)
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
expect(filtered_search.value).to eq("label:~#{bug_label.title}") expect(filtered_search.value).to eq("label:~#{bug_label.title}")
end end
...@@ -147,42 +165,49 @@ describe 'Dropdown label', js: true, feature: true do ...@@ -147,42 +165,49 @@ describe 'Dropdown label', js: true, feature: true do
it 'fills in the label name when the label is partially filled' do it 'fills in the label name when the label is partially filled' do
send_keys_to_filtered_search('bu') send_keys_to_filtered_search('bu')
click_label(bug_label.title) click_label(bug_label.title)
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
expect(filtered_search.value).to eq("label:~#{bug_label.title}") expect(filtered_search.value).to eq("label:~#{bug_label.title}")
end end
it 'fills in the label name that contains multiple words' do it 'fills in the label name that contains multiple words' do
click_label(two_words_label.title) click_label(two_words_label.title)
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
expect(filtered_search.value).to eq("label:~\"#{two_words_label.title}\"") expect(filtered_search.value).to eq("label:~\"#{two_words_label.title}\"")
end end
it 'fills in the label name that contains multiple words and is very long' do it 'fills in the label name that contains multiple words and is very long' do
click_label(long_label.title) click_label(long_label.title)
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
expect(filtered_search.value).to eq("label:~\"#{long_label.title}\"") expect(filtered_search.value).to eq("label:~\"#{long_label.title}\"")
end end
it 'fills in the label name that contains double quotes' do it 'fills in the label name that contains double quotes' do
click_label(wont_fix_label.title) click_label(wont_fix_label.title)
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
expect(filtered_search.value).to eq("label:~'#{wont_fix_label.title}'") expect(filtered_search.value).to eq("label:~'#{wont_fix_label.title}'")
end end
it 'fills in the label name with the correct capitalization' do it 'fills in the label name with the correct capitalization' do
click_label(uppercase_label.title) click_label(uppercase_label.title)
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
expect(filtered_search.value).to eq("label:~#{uppercase_label.title}") expect(filtered_search.value).to eq("label:~#{uppercase_label.title}")
end end
it 'fills in the label name with special characters' do it 'fills in the label name with special characters' do
click_label(special_label.title) click_label(special_label.title)
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
expect(filtered_search.value).to eq("label:~#{special_label.title}") expect(filtered_search.value).to eq("label:~#{special_label.title}")
end end
it 'selects `no label`' do it 'selects `no label`' do
find('#js-dropdown-label .filter-dropdown-item', text: 'No Label').click find('#js-dropdown-label .filter-dropdown-item', text: 'No Label').click
expect(page).to have_css(js_dropdown_label, visible: false) expect(page).to have_css(js_dropdown_label, visible: false)
expect(filtered_search.value).to eq("label:none") expect(filtered_search.value).to eq("label:none")
end end
......
...@@ -47,26 +47,31 @@ describe 'Dropdown milestone', js: true, feature: true do ...@@ -47,26 +47,31 @@ describe 'Dropdown milestone', js: true, feature: true do
describe 'behavior' do describe 'behavior' do
it 'opens when the search bar has milestone:' do it 'opens when the search bar has milestone:' do
filtered_search.set('milestone:') filtered_search.set('milestone:')
expect(page).to have_css(js_dropdown_milestone, visible: true) expect(page).to have_css(js_dropdown_milestone, visible: true)
end end
it 'closes when the search bar is unfocused' do it 'closes when the search bar is unfocused' do
find('body').click() find('body').click()
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
end end
it 'should show loading indicator when opened' do it 'should show loading indicator when opened' do
filtered_search.set('milestone:') filtered_search.set('milestone:')
expect(page).to have_css('#js-dropdown-milestone .filter-dropdown-loading', visible: true) expect(page).to have_css('#js-dropdown-milestone .filter-dropdown-loading', visible: true)
end end
it 'should hide loading indicator when loaded' do it 'should hide loading indicator when loaded' do
send_keys_to_filtered_search('milestone:') send_keys_to_filtered_search('milestone:')
expect(page).not_to have_css('#js-dropdown-milestone .filter-dropdown-loading') expect(page).not_to have_css('#js-dropdown-milestone .filter-dropdown-loading')
end end
it 'should load all the milestones when opened' do it 'should load all the milestones when opened' do
send_keys_to_filtered_search('milestone:') send_keys_to_filtered_search('milestone:')
expect(dropdown_milestone_size).to be > 0 expect(dropdown_milestone_size).to be > 0
end end
end end
...@@ -78,31 +83,37 @@ describe 'Dropdown milestone', js: true, feature: true do ...@@ -78,31 +83,37 @@ describe 'Dropdown milestone', js: true, feature: true do
it 'filters by name' do it 'filters by name' do
send_keys_to_filtered_search(':v1') send_keys_to_filtered_search(':v1')
expect(dropdown_milestone_size).to eq(1) expect(dropdown_milestone_size).to eq(1)
end end
it 'filters by case insensitive name' do it 'filters by case insensitive name' do
send_keys_to_filtered_search(':V1') send_keys_to_filtered_search(':V1')
expect(dropdown_milestone_size).to eq(1) expect(dropdown_milestone_size).to eq(1)
end end
it 'filters by name with symbol' do it 'filters by name with symbol' do
send_keys_to_filtered_search(':%v1') send_keys_to_filtered_search(':%v1')
expect(dropdown_milestone_size).to eq(1) expect(dropdown_milestone_size).to eq(1)
end end
it 'filters by case insensitive name with symbol' do it 'filters by case insensitive name with symbol' do
send_keys_to_filtered_search(':%V1') send_keys_to_filtered_search(':%V1')
expect(dropdown_milestone_size).to eq(1) expect(dropdown_milestone_size).to eq(1)
end end
it 'filters by special characters' do it 'filters by special characters' do
send_keys_to_filtered_search(':(+') send_keys_to_filtered_search(':(+')
expect(dropdown_milestone_size).to eq(1) expect(dropdown_milestone_size).to eq(1)
end end
it 'filters by special characters with symbol' do it 'filters by special characters with symbol' do
send_keys_to_filtered_search(':%(+') send_keys_to_filtered_search(':%(+')
expect(dropdown_milestone_size).to eq(1) expect(dropdown_milestone_size).to eq(1)
end end
end end
...@@ -114,6 +125,7 @@ describe 'Dropdown milestone', js: true, feature: true do ...@@ -114,6 +125,7 @@ describe 'Dropdown milestone', js: true, feature: true do
it 'fills in the milestone name when the milestone has not been filled' do it 'fills in the milestone name when the milestone has not been filled' do
click_milestone(milestone.title) click_milestone(milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:%#{milestone.title}") expect(filtered_search.value).to eq("milestone:%#{milestone.title}")
end end
...@@ -121,48 +133,56 @@ describe 'Dropdown milestone', js: true, feature: true do ...@@ -121,48 +133,56 @@ describe 'Dropdown milestone', js: true, feature: true do
it 'fills in the milestone name when the milestone is partially filled' do it 'fills in the milestone name when the milestone is partially filled' do
send_keys_to_filtered_search('v') send_keys_to_filtered_search('v')
click_milestone(milestone.title) click_milestone(milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:%#{milestone.title}") expect(filtered_search.value).to eq("milestone:%#{milestone.title}")
end end
it 'fills in the milestone name that contains multiple words' do it 'fills in the milestone name that contains multiple words' do
click_milestone(two_words_milestone.title) click_milestone(two_words_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:%\"#{two_words_milestone.title}\"") expect(filtered_search.value).to eq("milestone:%\"#{two_words_milestone.title}\"")
end end
it 'fills in the milestone name that contains multiple words and is very long' do it 'fills in the milestone name that contains multiple words and is very long' do
click_milestone(long_milestone.title) click_milestone(long_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:%\"#{long_milestone.title}\"") expect(filtered_search.value).to eq("milestone:%\"#{long_milestone.title}\"")
end end
it 'fills in the milestone name that contains double quotes' do it 'fills in the milestone name that contains double quotes' do
click_milestone(wont_fix_milestone.title) click_milestone(wont_fix_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:%'#{wont_fix_milestone.title}'") expect(filtered_search.value).to eq("milestone:%'#{wont_fix_milestone.title}'")
end end
it 'fills in the milestone name with the correct capitalization' do it 'fills in the milestone name with the correct capitalization' do
click_milestone(uppercase_milestone.title) click_milestone(uppercase_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:%#{uppercase_milestone.title}") expect(filtered_search.value).to eq("milestone:%#{uppercase_milestone.title}")
end end
it 'fills in the milestone name with special characters' do it 'fills in the milestone name with special characters' do
click_milestone(special_milestone.title) click_milestone(special_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:%#{special_milestone.title}") expect(filtered_search.value).to eq("milestone:%#{special_milestone.title}")
end end
it 'selects `no milestone`' do it 'selects `no milestone`' do
click_static_milestone('No Milestone') click_static_milestone('No Milestone')
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:none") expect(filtered_search.value).to eq("milestone:none")
end end
it 'selects `upcoming milestone`' do it 'selects `upcoming milestone`' do
click_static_milestone('Upcoming') click_static_milestone('Upcoming')
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
expect(filtered_search.value).to eq("milestone:upcoming") expect(filtered_search.value).to eq("milestone:upcoming")
end end
...@@ -171,26 +191,31 @@ describe 'Dropdown milestone', js: true, feature: true do ...@@ -171,26 +191,31 @@ describe 'Dropdown milestone', js: true, feature: true do
describe 'input has existing content' do describe 'input has existing content' do
it 'opens milestone dropdown with existing search term' do it 'opens milestone dropdown with existing search term' do
filtered_search.set('searchTerm milestone:') filtered_search.set('searchTerm milestone:')
expect(page).to have_css(js_dropdown_milestone, visible: true) expect(page).to have_css(js_dropdown_milestone, visible: true)
end end
it 'opens milestone dropdown with existing author' do it 'opens milestone dropdown with existing author' do
filtered_search.set('author:@john milestone:') filtered_search.set('author:@john milestone:')
expect(page).to have_css(js_dropdown_milestone, visible: true) expect(page).to have_css(js_dropdown_milestone, visible: true)
end end
it 'opens milestone dropdown with existing assignee' do it 'opens milestone dropdown with existing assignee' do
filtered_search.set('assignee:@john milestone:') filtered_search.set('assignee:@john milestone:')
expect(page).to have_css(js_dropdown_milestone, visible: true) expect(page).to have_css(js_dropdown_milestone, visible: true)
end end
it 'opens milestone dropdown with existing label' do it 'opens milestone dropdown with existing label' do
filtered_search.set('label:~important milestone:') filtered_search.set('label:~important milestone:')
expect(page).to have_css(js_dropdown_milestone, visible: true) expect(page).to have_css(js_dropdown_milestone, visible: true)
end end
it 'opens milestone dropdown with existing milestone' do it 'opens milestone dropdown with existing milestone' do
filtered_search.set('milestone:%100 milestone:') filtered_search.set('milestone:%100 milestone:')
expect(page).to have_css(js_dropdown_milestone, visible: true) expect(page).to have_css(js_dropdown_milestone, visible: true)
end end
end end
......
...@@ -101,15 +101,18 @@ describe 'Filter issues', js: true, feature: true do ...@@ -101,15 +101,18 @@ describe 'Filter issues', js: true, feature: true do
context 'only author' do context 'only author' do
it 'filters issues by searched author' do it 'filters issues by searched author' do
input_filtered_search("author:@#{user.username}") input_filtered_search("author:@#{user.username}")
expect_issues_list_count(5) expect_issues_list_count(5)
end end
it 'filters issues by invalid author' do it 'filters issues by invalid author' do
# YOLO pending('to be tested, issue #26546')
fail
end end
it 'filters issues by multiple authors' do it 'filters issues by multiple authors' do
# YOLO pending('to be tested, issue #26546')
fail
end end
end end
...@@ -117,6 +120,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -117,6 +120,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched author and text' do it 'filters issues by searched author and text' do
search = "author:@#{user.username} issue" search = "author:@#{user.username} issue"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(3) expect_issues_list_count(3)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -124,6 +128,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -124,6 +128,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched author, assignee and text' do it 'filters issues by searched author, assignee and text' do
search = "author:@#{user.username} assignee:@#{user.username} issue" search = "author:@#{user.username} assignee:@#{user.username} issue"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(3) expect_issues_list_count(3)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -131,6 +136,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -131,6 +136,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched author, assignee, label, and text' do it 'filters issues by searched author, assignee, label, and text' do
search = "author:@#{user.username} assignee:@#{user.username} label:~#{caps_sensitive_label.title} issue" search = "author:@#{user.username} assignee:@#{user.username} label:~#{caps_sensitive_label.title} issue"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -138,13 +144,15 @@ describe 'Filter issues', js: true, feature: true do ...@@ -138,13 +144,15 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched author, assignee, label, milestone and text' do it 'filters issues by searched author, assignee, label, milestone and text' do
search = "author:@#{user.username} assignee:@#{user.username} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} issue" search = "author:@#{user.username} assignee:@#{user.username} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} issue"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
end end
context 'sorting' do it 'sorting' do
# TODO pending('to be tested, issue #26546')
fail
end end
end end
...@@ -153,6 +161,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -153,6 +161,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched assignee' do it 'filters issues by searched assignee' do
search = "assignee:@#{user.username}" search = "assignee:@#{user.username}"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(5) expect_issues_list_count(5)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -160,16 +169,19 @@ describe 'Filter issues', js: true, feature: true do ...@@ -160,16 +169,19 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by no assignee' do it 'filters issues by no assignee' do
search = "assignee:none" search = "assignee:none"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(8, 1) expect_issues_list_count(8, 1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
it 'filters issues by invalid assignee' do it 'filters issues by invalid assignee' do
# YOLO pending('to be tested, issue #26546')
fail
end end
it 'filters issues by multiple assignees' do it 'filters issues by multiple assignees' do
# YOLO pending('to be tested, issue #26546')
fail
end end
end end
...@@ -177,6 +189,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -177,6 +189,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched assignee and text' do it 'filters issues by searched assignee and text' do
search = "assignee:@#{user.username} searchTerm" search = "assignee:@#{user.username} searchTerm"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -184,6 +197,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -184,6 +197,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched assignee, author and text' do it 'filters issues by searched assignee, author and text' do
search = "assignee:@#{user.username} author:@#{user.username} searchTerm" search = "assignee:@#{user.username} author:@#{user.username} searchTerm"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -191,6 +205,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -191,6 +205,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched assignee, author, label, text' do it 'filters issues by searched assignee, author, label, text' do
search = "assignee:@#{user.username} author:@#{user.username} label:~#{caps_sensitive_label.title} searchTerm" search = "assignee:@#{user.username} author:@#{user.username} label:~#{caps_sensitive_label.title} searchTerm"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -198,13 +213,17 @@ describe 'Filter issues', js: true, feature: true do ...@@ -198,13 +213,17 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched assignee, author, label, milestone and text' do it 'filters issues by searched assignee, author, label, milestone and text' do
search = "assignee:@#{user.username} author:@#{user.username} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} searchTerm" search = "assignee:@#{user.username} author:@#{user.username} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} searchTerm"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
end end
context 'sorting' do context 'sorting' do
# TODO it 'sorts' do
pending('to be tested, issue #26546')
fail
end
end end
end end
...@@ -213,6 +232,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -213,6 +232,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label' do it 'filters issues by searched label' do
search = "label:~#{bug_label.title}" search = "label:~#{bug_label.title}"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -220,17 +240,20 @@ describe 'Filter issues', js: true, feature: true do ...@@ -220,17 +240,20 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by no label' do it 'filters issues by no label' do
search = "label:none" search = "label:none"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(9, 1) expect_issues_list_count(9, 1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
it 'filters issues by invalid label' do it 'filters issues by invalid label' do
# YOLO pending('to be tested, issue #26546')
fail
end end
it 'filters issues by multiple labels' do it 'filters issues by multiple labels' do
search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title}" search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title}"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -242,6 +265,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -242,6 +265,7 @@ describe 'Filter issues', js: true, feature: true do
search = "label:~#{special_label.title}" search = "label:~#{special_label.title}"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -251,6 +275,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -251,6 +275,7 @@ describe 'Filter issues', js: true, feature: true do
search = "label:~#{new_label.title}" search = "label:~#{new_label.title}"
input_filtered_search(search) input_filtered_search(search)
expect_no_issues_list() expect_no_issues_list()
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -264,6 +289,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -264,6 +289,7 @@ describe 'Filter issues', js: true, feature: true do
search = "label:~'#{special_multiple_label.title}'" search = "label:~'#{special_multiple_label.title}'"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
# filtered search defaults quotations to double quotes # filtered search defaults quotations to double quotes
...@@ -273,14 +299,15 @@ describe 'Filter issues', js: true, feature: true do ...@@ -273,14 +299,15 @@ describe 'Filter issues', js: true, feature: true do
it 'single quotes' do it 'single quotes' do
search = "label:~'#{multiple_words_label.title}'" search = "label:~'#{multiple_words_label.title}'"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1)
expect_issues_list_count(1)
expect_filtered_search_input("label:~\"#{multiple_words_label.title}\"") expect_filtered_search_input("label:~\"#{multiple_words_label.title}\"")
end end
it 'double quotes' do it 'double quotes' do
search = "label:~\"#{multiple_words_label.title}\"" search = "label:~\"#{multiple_words_label.title}\""
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -292,6 +319,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -292,6 +319,7 @@ describe 'Filter issues', js: true, feature: true do
search = "label:~'#{double_quotes_label.title}'" search = "label:~'#{double_quotes_label.title}'"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -303,6 +331,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -303,6 +331,7 @@ describe 'Filter issues', js: true, feature: true do
search = "label:~\"#{single_quotes_label.title}\"" search = "label:~\"#{single_quotes_label.title}\""
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -312,6 +341,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -312,6 +341,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label and text' do it 'filters issues by searched label and text' do
search = "label:~#{caps_sensitive_label.title} bug" search = "label:~#{caps_sensitive_label.title} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -319,6 +349,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -319,6 +349,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label, author and text' do it 'filters issues by searched label, author and text' do
search = "label:~#{caps_sensitive_label.title} author:@#{user.username} bug" search = "label:~#{caps_sensitive_label.title} author:@#{user.username} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -326,6 +357,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -326,6 +357,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label, author, assignee and text' do it 'filters issues by searched label, author, assignee and text' do
search = "label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} bug" search = "label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -333,6 +365,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -333,6 +365,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label, author, assignee, milestone and text' do it 'filters issues by searched label, author, assignee, milestone and text' do
search = "label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} milestone:%#{milestone.title} bug" search = "label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} milestone:%#{milestone.title} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -342,6 +375,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -342,6 +375,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label, label2, and text' do it 'filters issues by searched label, label2, and text' do
search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title} bug" search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -349,6 +383,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -349,6 +383,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label, label2, author and text' do it 'filters issues by searched label, label2, author and text' do
search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} bug" search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -356,6 +391,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -356,6 +391,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label, label2, author, assignee and text' do it 'filters issues by searched label, label2, author, assignee and text' do
search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} bug" search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -363,6 +399,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -363,6 +399,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label, label2, author, assignee, milestone and text' do it 'filters issues by searched label, label2, author, assignee, milestone and text' do
search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} milestone:%#{milestone.title} bug" search = "label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} milestone:%#{milestone.title} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -384,7 +421,10 @@ describe 'Filter issues', js: true, feature: true do ...@@ -384,7 +421,10 @@ describe 'Filter issues', js: true, feature: true do
end end
context 'sorting' do context 'sorting' do
# TODO it 'sorts' do
pending('to be tested, issue #26546')
fail
end
end end
end end
...@@ -392,25 +432,30 @@ describe 'Filter issues', js: true, feature: true do ...@@ -392,25 +432,30 @@ describe 'Filter issues', js: true, feature: true do
context 'only milestone' do context 'only milestone' do
it 'filters issues by searched milestone' do it 'filters issues by searched milestone' do
input_filtered_search("milestone:%#{milestone.title}") input_filtered_search("milestone:%#{milestone.title}")
expect_issues_list_count(5) expect_issues_list_count(5)
end end
it 'filters issues by no milestone' do it 'filters issues by no milestone' do
input_filtered_search("milestone:none") input_filtered_search("milestone:none")
expect_issues_list_count(7, 1) expect_issues_list_count(7, 1)
end end
it 'filters issues by upcoming milestones' do it 'filters issues by upcoming milestones' do
input_filtered_search("milestone:upcoming") input_filtered_search("milestone:upcoming")
expect_issues_list_count(1) expect_issues_list_count(1)
end end
it 'filters issues by invalid milestones' do it 'filters issues by invalid milestones' do
# YOLO pending('to be tested, issue #26546')
fail
end end
it 'filters issues by multiple milestones' do it 'filters issues by multiple milestones' do
# YOLO pending('to be tested, issue #26546')
fail
end end
it 'filters issues by milestone containing special characters' do it 'filters issues by milestone containing special characters' do
...@@ -419,6 +464,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -419,6 +464,7 @@ describe 'Filter issues', js: true, feature: true do
search = "milestone:%#{special_milestone.title}" search = "milestone:%#{special_milestone.title}"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -428,6 +474,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -428,6 +474,7 @@ describe 'Filter issues', js: true, feature: true do
search = "milestone:%#{new_milestone.title}" search = "milestone:%#{new_milestone.title}"
input_filtered_search(search) input_filtered_search(search)
expect_no_issues_list() expect_no_issues_list()
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -437,6 +484,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -437,6 +484,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched milestone and text' do it 'filters issues by searched milestone and text' do
search = "milestone:%#{milestone.title} bug" search = "milestone:%#{milestone.title} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -444,6 +492,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -444,6 +492,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched milestone, author and text' do it 'filters issues by searched milestone, author and text' do
search = "milestone:%#{milestone.title} author:@#{user.username} bug" search = "milestone:%#{milestone.title} author:@#{user.username} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -451,6 +500,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -451,6 +500,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched milestone, author, assignee and text' do it 'filters issues by searched milestone, author, assignee and text' do
search = "milestone:%#{milestone.title} author:@#{user.username} assignee:@#{user.username} bug" search = "milestone:%#{milestone.title} author:@#{user.username} assignee:@#{user.username} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -458,13 +508,17 @@ describe 'Filter issues', js: true, feature: true do ...@@ -458,13 +508,17 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched milestone, author, assignee, label and text' do it 'filters issues by searched milestone, author, assignee, label and text' do
search = "milestone:%#{milestone.title} author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} bug" search = "milestone:%#{milestone.title} author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} bug"
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
end end
context 'sorting' do context 'sorting' do
# TODO it 'sorts' do
pending('to be tested, issue #26546')
fail
end
end end
end end
...@@ -473,6 +527,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -473,6 +527,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched text' do it 'filters issues by searched text' do
search = 'Bug' search = 'Bug'
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(4, 1) expect_issues_list_count(4, 1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -480,6 +535,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -480,6 +535,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by multiple searched text' do it 'filters issues by multiple searched text' do
search = 'Bug report' search = 'Bug report'
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(3) expect_issues_list_count(3)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -487,6 +543,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -487,6 +543,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by case insensitive searched text' do it 'filters issues by case insensitive searched text' do
search = 'bug report' search = 'bug report'
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(3) expect_issues_list_count(3)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -494,6 +551,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -494,6 +551,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched text containing single quotes' do it 'filters issues by searched text containing single quotes' do
search = '\'single quotes\'' search = '\'single quotes\''
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -501,6 +559,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -501,6 +559,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched text containing double quotes' do it 'filters issues by searched text containing double quotes' do
search = '"double quotes"' search = '"double quotes"'
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -508,6 +567,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -508,6 +567,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched text containing special characters' do it 'filters issues by searched text containing special characters' do
search = '!@#{$%^&*()-+' search = '!@#{$%^&*()-+'
input_filtered_search(search) input_filtered_search(search)
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -515,6 +575,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -515,6 +575,7 @@ describe 'Filter issues', js: true, feature: true do
it 'does not show any issues' do it 'does not show any issues' do
search = 'testing' search = 'testing'
input_filtered_search(search) input_filtered_search(search)
expect_no_issues_list() expect_no_issues_list()
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
...@@ -523,66 +584,77 @@ describe 'Filter issues', js: true, feature: true do ...@@ -523,66 +584,77 @@ describe 'Filter issues', js: true, feature: true do
context 'searched text with other filters' do context 'searched text with other filters' do
it 'filters issues by searched text and author' do it 'filters issues by searched text and author' do
input_filtered_search("bug author:@#{user.username}") input_filtered_search("bug author:@#{user.username}")
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input("author:@#{user.username} bug") expect_filtered_search_input("author:@#{user.username} bug")
end end
it 'filters issues by searched text, author and more text' do it 'filters issues by searched text, author and more text' do
input_filtered_search("bug author:@#{user.username} report") input_filtered_search("bug author:@#{user.username} report")
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input("author:@#{user.username} bug report") expect_filtered_search_input("author:@#{user.username} bug report")
end end
it 'filters issues by searched text, author and assignee' do it 'filters issues by searched text, author and assignee' do
input_filtered_search("bug author:@#{user.username} assignee:@#{user.username}") input_filtered_search("bug author:@#{user.username} assignee:@#{user.username}")
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} bug") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} bug")
end end
it 'filters issues by searched text, author, more text and assignee' do it 'filters issues by searched text, author, more text and assignee' do
input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username}") input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username}")
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} bug report") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} bug report")
end end
it 'filters issues by searched text, author, more text, assignee and even more text' do it 'filters issues by searched text, author, more text, assignee and even more text' do
input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} with") input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} with")
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} bug report with") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} bug report with")
end end
it 'filters issues by searched text, author, assignee and label' do it 'filters issues by searched text, author, assignee and label' do
input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title}") input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title}")
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} bug") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} bug")
end end
it 'filters issues by searched text, author, text, assignee, text, label and text' do it 'filters issues by searched text, author, text, assignee, text, label and text' do
input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} with label:~#{bug_label.title} everything") input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} with label:~#{bug_label.title} everything")
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} bug report with everything") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} bug report with everything")
end end
it 'filters issues by searched text, author, assignee, label and milestone' do it 'filters issues by searched text, author, assignee, label and milestone' do
input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} milestone:%#{milestone.title}") input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} milestone:%#{milestone.title}")
expect_issues_list_count(2) expect_issues_list_count(2)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} milestone:%#{milestone.title} bug") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} milestone:%#{milestone.title} bug")
end end
it 'filters issues by searched text, author, text, assignee, text, label, text, milestone and text' do it 'filters issues by searched text, author, text, assignee, text, label, text, milestone and text' do
input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} with label:~#{bug_label.title} everything milestone:%#{milestone.title} you") input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} with label:~#{bug_label.title} everything milestone:%#{milestone.title} you")
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} milestone:%#{milestone.title} bug report with everything you") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} milestone:%#{milestone.title} bug report with everything you")
end end
it 'filters issues by searched text, author, assignee, multiple labels and milestone' do it 'filters issues by searched text, author, assignee, multiple labels and milestone' do
input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title}") input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title}")
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} bug") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} bug")
end end
it 'filters issues by searched text, author, text, assignee, text, label1, text, label2, text, milestone and text' do it 'filters issues by searched text, author, text, assignee, text, label1, text, label2, text, milestone and text' do
input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} with label:~#{bug_label.title} everything label:~#{caps_sensitive_label.title} you milestone:%#{milestone.title} thought") input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} with label:~#{bug_label.title} everything label:~#{caps_sensitive_label.title} you milestone:%#{milestone.title} thought")
expect_issues_list_count(1) expect_issues_list_count(1)
expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} bug report with everything you thought") expect_filtered_search_input("author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} bug report with everything you thought")
end end
...@@ -605,6 +677,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -605,6 +677,7 @@ describe 'Filter issues', js: true, feature: true do
updated_at: 5.days.ago) updated_at: 5.days.ago)
input_filtered_search('days ago') input_filtered_search('days ago')
expect_issues_list_count(2) expect_issues_list_count(2)
sort_toggle = find('.filtered-search-container .dropdown-toggle') sort_toggle = find('.filtered-search-container .dropdown-toggle')
...@@ -639,6 +712,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -639,6 +712,7 @@ describe 'Filter issues', js: true, feature: true do
it 'closed state' do it 'closed state' do
find('.issues-state-filters a', text: 'Closed').click find('.issues-state-filters a', text: 'Closed').click
wait_for_ajax wait_for_ajax
expect(page).to have_selector('.issues-list .issue', count: 1) expect(page).to have_selector('.issues-list .issue', count: 1)
expect(find('.issues-list .issue:first-of-type .issue-title-text a')).to have_content(closed_issue.title) expect(find('.issues-list .issue:first-of-type .issue-title-text a')).to have_content(closed_issue.title)
end end
...@@ -646,6 +720,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -646,6 +720,7 @@ describe 'Filter issues', js: true, feature: true do
it 'all state' do it 'all state' do
find('.issues-state-filters a', text: 'All').click find('.issues-state-filters a', text: 'All').click
wait_for_ajax wait_for_ajax
expect(page).to have_selector('.issues-list .issue', count: 5) expect(page).to have_selector('.issues-list .issue', count: 5)
end end
end end
...@@ -657,6 +732,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -657,6 +732,7 @@ describe 'Filter issues', js: true, feature: true do
params = CGI.parse(URI.parse(link[:href]).query) params = CGI.parse(URI.parse(link[:href]).query)
auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) auto_discovery_link = find('link[type="application/atom+xml"]', visible: false)
auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query) auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query)
expect(params).to include('private_token' => [user.private_token]) expect(params).to include('private_token' => [user.private_token])
expect(params).to include('milestone_title' => [milestone.title]) expect(params).to include('milestone_title' => [milestone.title])
expect(params).to include('assignee_id' => [user.id.to_s]) expect(params).to include('assignee_id' => [user.id.to_s])
...@@ -671,6 +747,7 @@ describe 'Filter issues', js: true, feature: true do ...@@ -671,6 +747,7 @@ describe 'Filter issues', js: true, feature: true do
params = CGI.parse(URI.parse(link[:href]).query) params = CGI.parse(URI.parse(link[:href]).query)
auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) auto_discovery_link = find('link[type="application/atom+xml"]', visible: false)
auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query) auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query)
expect(params).to include('private_token' => [user.private_token]) expect(params).to include('private_token' => [user.private_token])
expect(params).to include('milestone_title' => [milestone.title]) expect(params).to include('milestone_title' => [milestone.title])
expect(params).to include('assignee_id' => [user.id.to_s]) expect(params).to include('assignee_id' => [user.id.to_s])
......
...@@ -27,6 +27,7 @@ describe 'Search bar', js: true, feature: true do ...@@ -27,6 +27,7 @@ describe 'Search bar', js: true, feature: true do
expect(filtered_search.value).to eq(search_text) expect(filtered_search.value).to eq(search_text)
find('.filtered-search-input-container .clear-search').click find('.filtered-search-input-container .clear-search').click
expect(filtered_search.value).to eq('') expect(filtered_search.value).to eq('')
end end
...@@ -37,12 +38,14 @@ describe 'Search bar', js: true, feature: true do ...@@ -37,12 +38,14 @@ describe 'Search bar', js: true, feature: true do
it 'hides after clicked' do it 'hides after clicked' do
filtered_search.set('a') filtered_search.set('a')
find('.filtered-search-input-container .clear-search').click find('.filtered-search-input-container .clear-search').click
expect(page).to have_css('.clear-search', visible: false) expect(page).to have_css('.clear-search', visible: false)
end end
it 'hides when there is no text' do it 'hides when there is no text' do
filtered_search.set('a') filtered_search.set('a')
filtered_search.set('') filtered_search.set('')
expect(page).to have_css('.clear-search', visible: false) expect(page).to have_css('.clear-search', visible: false)
end end
...@@ -57,10 +60,12 @@ describe 'Search bar', js: true, feature: true do ...@@ -57,10 +60,12 @@ describe 'Search bar', js: true, feature: true do
original_size = page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size original_size = page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size
filtered_search.set('author') filtered_search.set('author')
expect(page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size).to eq(1) expect(page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size).to eq(1)
find('.filtered-search-input-container .clear-search').click find('.filtered-search-input-container .clear-search').click
filtered_search.click filtered_search.click
expect(page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size).to eq(original_size) expect(page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size).to eq(original_size)
end end
...@@ -70,10 +75,12 @@ describe 'Search bar', js: true, feature: true do ...@@ -70,10 +75,12 @@ describe 'Search bar', js: true, feature: true do
hint_offset = get_left_style(hint_style) hint_offset = get_left_style(hint_style)
filtered_search.set('author:') filtered_search.set('author:')
expect(page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size).to eq(0) expect(page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size).to eq(0)
find('.filtered-search-input-container .clear-search').click find('.filtered-search-input-container .clear-search').click
filtered_search.click filtered_search.click
expect(page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size).to be > 0 expect(page.all('#js-dropdown-hint .filter-dropdown .filter-dropdown-item').size).to be > 0
expect(get_left_style(page.find('#js-dropdown-hint')['style'])).to eq(hint_offset) expect(get_left_style(page.find('#js-dropdown-hint')['style'])).to eq(hint_offset)
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