Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b84d6efa
Commit
b84d6efa
authored
Aug 16, 2017
by
Clement Ho
Committed by
Rémy Coutable
Aug 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change find to within for detecting bad search specs
parent
fcce6c31
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
209 additions
and
147 deletions
+209
-147
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
...features/issues/filtered_search/dropdown_assignee_spec.rb
+8
-4
spec/features/issues/filtered_search/dropdown_author_spec.rb
spec/features/issues/filtered_search/dropdown_author_spec.rb
+7
-3
spec/features/issues/filtered_search/dropdown_label_spec.rb
spec/features/issues/filtered_search/dropdown_label_spec.rb
+9
-9
spec/features/issues/filtered_search/dropdown_milestone_spec.rb
...eatures/issues/filtered_search/dropdown_milestone_spec.rb
+10
-10
spec/features/issues/filtered_search/filter_issues_spec.rb
spec/features/issues/filtered_search/filter_issues_spec.rb
+110
-82
spec/features/issues/filtered_search/search_bar_spec.rb
spec/features/issues/filtered_search/search_bar_spec.rb
+1
-1
spec/features/issues/filtered_search/visual_tokens_spec.rb
spec/features/issues/filtered_search/visual_tokens_spec.rb
+2
-2
spec/features/merge_requests/filter_by_milestone_spec.rb
spec/features/merge_requests/filter_by_milestone_spec.rb
+1
-1
spec/features/merge_requests/filter_merge_requests_spec.rb
spec/features/merge_requests/filter_merge_requests_spec.rb
+33
-25
spec/features/search_spec.rb
spec/features/search_spec.rb
+4
-8
spec/support/filtered_search_helpers.rb
spec/support/filtered_search_helpers.rb
+24
-2
No files found.
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
View file @
b84d6efa
...
...
@@ -134,8 +134,10 @@ describe 'Dropdown assignee', :js do
it
'fills in the assignee username when the assignee has not been filtered'
do
click_assignee
(
user_jacob
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user_jacob
.
username
}
"
}
])
expect_tokens
([
assignee_token
(
user_jacob
.
name
)
])
expect_filtered_search_input_empty
end
...
...
@@ -143,8 +145,10 @@ describe 'Dropdown assignee', :js do
filtered_search
.
send_keys
(
'roo'
)
click_assignee
(
user
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
assignee_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
...
...
@@ -152,7 +156,7 @@ describe 'Dropdown assignee', :js do
find
(
'#js-dropdown-assignee .filter-dropdown-item'
,
text:
'No Assignee'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
{
name:
'assignee'
,
value:
'none'
}
])
expect_tokens
([
assignee_token
(
'none'
)
])
expect_filtered_search_input_empty
end
end
...
...
@@ -171,7 +175,7 @@ describe 'Dropdown assignee', :js do
find
(
'#js-dropdown-assignee .filter-dropdown-item'
,
text:
user
.
username
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
{
name:
'assignee'
,
value:
user
.
username
}
])
expect_tokens
([
assignee_token
(
user
.
username
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/dropdown_author_spec.rb
View file @
b84d6efa
...
...
@@ -121,16 +121,20 @@ describe 'Dropdown author', js: true do
it
'fills in the author username when the author has not been filtered'
do
click_author
(
user_jacob
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
false
)
expect_tokens
([
{
name:
'author'
,
value:
"@
#{
user_jacob
.
username
}
"
}
])
expect_tokens
([
author_token
(
user_jacob
.
name
)
])
expect_filtered_search_input_empty
end
it
'fills in the author username when the author has been filtered'
do
click_author
(
user
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
false
)
expect_tokens
([
{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
author_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
end
...
...
@@ -149,7 +153,7 @@ describe 'Dropdown author', js: true do
find
(
'#js-dropdown-author .filter-dropdown-item'
,
text:
user
.
username
).
click
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
false
)
expect_tokens
([
{
name:
'author'
,
value:
user
.
username
}
])
expect_tokens
([
author_token
(
user
.
username
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/dropdown_label_spec.rb
View file @
b84d6efa
...
...
@@ -47,7 +47,7 @@ describe 'Dropdown label', js: true do
filtered_search
.
native
.
send_keys
(
:down
,
:down
,
:enter
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
bug_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
bug_label
.
title
)
])
expect_filtered_search_input_empty
end
end
...
...
@@ -178,7 +178,7 @@ describe 'Dropdown label', js: true do
click_label
(
bug_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
bug_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
bug_label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -187,7 +187,7 @@ describe 'Dropdown label', js: true do
click_label
(
bug_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
bug_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
bug_label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -195,7 +195,7 @@ describe 'Dropdown label', js: true do
click_label
(
two_words_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"
\"
#{
two_words_label
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
two_words_label
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -203,7 +203,7 @@ describe 'Dropdown label', js: true do
click_label
(
long_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"
\"
#{
long_label
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
long_label
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -211,7 +211,7 @@ describe 'Dropdown label', js: true do
click_label
(
wont_fix_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~'
#{
wont_fix_label
.
title
}
'"
}
])
expect_tokens
([
label_token
(
"'
#{
wont_fix_label
.
title
}
'"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -219,7 +219,7 @@ describe 'Dropdown label', js: true do
click_label
(
uppercase_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
uppercase_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
uppercase_label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -227,7 +227,7 @@ describe 'Dropdown label', js: true do
click_label
(
special_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
special_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
special_label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -235,7 +235,7 @@ describe 'Dropdown label', js: true do
find
(
"
#{
js_dropdown_label
}
.filter-dropdown-item"
,
text:
'No Label'
).
click
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
'none'
}
])
expect_tokens
([
label_token
(
'none'
,
false
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/dropdown_milestone_spec.rb
View file @
b84d6efa
...
...
@@ -134,7 +134,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
#{
milestone
.
title
}
"
}
])
expect_tokens
([
milestone_token
(
milestone
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -143,7 +143,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
#{
milestone
.
title
}
"
}
])
expect_tokens
([
milestone_token
(
milestone
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -151,7 +151,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
two_words_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
\"
#{
two_words_milestone
.
title
}
\"
"
}
])
expect_tokens
([
milestone_token
(
"
\"
#{
two_words_milestone
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -159,7 +159,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
long_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
\"
#{
long_milestone
.
title
}
\"
"
}
])
expect_tokens
([
milestone_token
(
"
\"
#{
long_milestone
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -167,7 +167,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
wont_fix_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%'
#{
wont_fix_milestone
.
title
}
'"
}
])
expect_tokens
([
milestone_token
(
"'
#{
wont_fix_milestone
.
title
}
'"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -175,7 +175,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
uppercase_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
#{
uppercase_milestone
.
title
}
"
}
])
expect_tokens
([
milestone_token
(
uppercase_milestone
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -183,7 +183,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
special_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
#{
special_milestone
.
title
}
"
}
])
expect_tokens
([
milestone_token
(
special_milestone
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -191,7 +191,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone
(
'No Milestone'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
'none'
}
])
expect_tokens
([
milestone_token
(
'none'
,
false
)
])
expect_filtered_search_input_empty
end
...
...
@@ -199,7 +199,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone
(
'Upcoming'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
'upcoming'
}
])
expect_tokens
([
milestone_token
(
'upcoming'
,
false
)
])
expect_filtered_search_input_empty
end
...
...
@@ -207,7 +207,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone
(
'Started'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
'started'
}
])
expect_tokens
([
milestone_token
(
'started'
,
false
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/filter_issues_spec.rb
View file @
b84d6efa
...
...
@@ -97,7 +97,9 @@ describe 'Filter issues', js: true do
it
'filters issues by searched author'
do
input_filtered_search
(
"author:@
#{
user
.
username
}
"
)
expect_tokens
([{
name:
'author'
,
value:
user
.
username
}])
wait_for_requests
expect_tokens
([
author_token
(
user
.
name
)])
expect_issues_list_count
(
5
)
expect_filtered_search_input_empty
end
...
...
@@ -117,7 +119,9 @@ describe 'Filter issues', js: true do
it
'filters issues by searched author and text'
do
input_filtered_search
(
"author:@
#{
user
.
username
}
#{
search_term
}
"
)
expect_tokens
([{
name:
'author'
,
value:
user
.
username
}])
wait_for_requests
expect_tokens
([
author_token
(
user
.
name
)])
expect_issues_list_count
(
3
)
expect_filtered_search_input
(
search_term
)
end
...
...
@@ -125,10 +129,9 @@ describe 'Filter issues', js: true do
it
'filters issues by searched author, assignee and text'
do
input_filtered_search
(
"author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
#{
search_term
}
"
)
expect_tokens
([
{
name:
'author'
,
value:
user
.
username
},
{
name:
'assignee'
,
value:
user
.
username
}
])
wait_for_requests
expect_tokens
([
author_token
(
user
.
name
),
assignee_token
(
user
.
name
)])
expect_issues_list_count
(
3
)
expect_filtered_search_input
(
search_term
)
end
...
...
@@ -136,10 +139,12 @@ describe 'Filter issues', js: true do
it
'filters issues by searched author, assignee, label, and text'
do
input_filtered_search
(
"author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
label:~
#{
caps_sensitive_label
.
title
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'assignee'
,
value:
user
.
username
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
author_token
(
user
.
name
)
,
assignee_token
(
user
.
name
)
,
label_token
(
caps_sensitive_label
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -148,11 +153,13 @@ describe 'Filter issues', js: true do
it
'filters issues by searched author, assignee, label, milestone and text'
do
input_filtered_search
(
"author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
label:~
#{
caps_sensitive_label
.
title
}
milestone:%
#{
milestone
.
title
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'assignee'
,
value:
user
.
username
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
,
{
name:
'milestone'
,
value:
milestone
.
title
}
author_token
(
user
.
name
)
,
assignee_token
(
user
.
name
)
,
label_token
(
caps_sensitive_label
.
title
)
,
milestone_token
(
milestone
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -169,7 +176,9 @@ describe 'Filter issues', js: true do
it
'filters issues by searched assignee'
do
input_filtered_search
(
"assignee:@
#{
user
.
username
}
"
)
expect_tokens
([{
name:
'assignee'
,
value:
user
.
username
}])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_issues_list_count
(
5
)
expect_filtered_search_input_empty
end
...
...
@@ -177,7 +186,7 @@ describe 'Filter issues', js: true do
it
'filters issues by no assignee'
do
input_filtered_search
(
'assignee:none'
)
expect_tokens
([
{
name:
'assignee'
,
value:
'none'
}
])
expect_tokens
([
assignee_token
(
'none'
)
])
expect_issues_list_count
(
8
,
1
)
expect_filtered_search_input_empty
end
...
...
@@ -197,7 +206,9 @@ describe 'Filter issues', js: true do
it
'filters issues by searched assignee and text'
do
input_filtered_search
(
"assignee:@
#{
user
.
username
}
#{
search_term
}
"
)
expect_tokens
([{
name:
'assignee'
,
value:
user
.
username
}])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_issues_list_count
(
2
)
expect_filtered_search_input
(
search_term
)
end
...
...
@@ -205,10 +216,9 @@ describe 'Filter issues', js: true do
it
'filters issues by searched assignee, author and text'
do
input_filtered_search
(
"assignee:@
#{
user
.
username
}
author:@
#{
user
.
username
}
#{
search_term
}
"
)
expect_tokens
([
{
name:
'assignee'
,
value:
user
.
username
},
{
name:
'author'
,
value:
user
.
username
}
])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
),
author_token
(
user
.
name
)])
expect_issues_list_count
(
2
)
expect_filtered_search_input
(
search_term
)
end
...
...
@@ -216,10 +226,12 @@ describe 'Filter issues', js: true do
it
'filters issues by searched assignee, author, label, text'
do
input_filtered_search
(
"assignee:@
#{
user
.
username
}
author:@
#{
user
.
username
}
label:~
#{
caps_sensitive_label
.
title
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'assignee'
,
value:
user
.
username
}
,
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
assignee_token
(
user
.
name
)
,
author_token
(
user
.
name
)
,
label_token
(
caps_sensitive_label
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -229,10 +241,10 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"assignee:@
#{
user
.
username
}
author:@
#{
user
.
username
}
label:~
#{
caps_sensitive_label
.
title
}
milestone:%
#{
milestone
.
title
}
#{
search_term
}
"
)
expect_tokens
([
{
name:
'assignee'
,
value:
user
.
username
}
,
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
,
{
name:
'milestone'
,
value:
milestone
.
title
}
assignee_token
(
user
.
name
)
,
author_token
(
user
.
name
)
,
label_token
(
caps_sensitive_label
.
title
)
,
milestone_token
(
milestone
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -253,7 +265,7 @@ describe 'Filter issues', js: true do
it
'filters issues by searched label'
do
input_filtered_search
(
"label:~
#{
bug_label
.
title
}
"
)
expect_tokens
([
{
name:
'label'
,
value:
bug_label
.
title
}
])
expect_tokens
([
label_token
(
bug_label
.
title
)
])
expect_issues_list_count
(
2
)
expect_filtered_search_input_empty
end
...
...
@@ -261,7 +273,7 @@ describe 'Filter issues', js: true do
it
'filters issues by no label'
do
input_filtered_search
(
'label:none'
)
expect_tokens
([
{
name:
'label'
,
value:
'none'
}
])
expect_tokens
([
label_token
(
'none'
,
false
)
])
expect_issues_list_count
(
9
,
1
)
expect_filtered_search_input_empty
end
...
...
@@ -274,8 +286,8 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"label:~
#{
bug_label
.
title
}
label:~
#{
caps_sensitive_label
.
title
}
"
)
expect_tokens
([
{
name:
'label'
,
value:
bug_label
.
title
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
label_token
(
bug_label
.
title
)
,
label_token
(
caps_sensitive_label
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input_empty
...
...
@@ -287,7 +299,8 @@ describe 'Filter issues', js: true do
special_issue
.
labels
<<
special_label
input_filtered_search
(
"label:~
#{
special_label
.
title
}
"
)
expect_tokens
([{
name:
'label'
,
value:
special_label
.
title
}])
expect_tokens
([
label_token
(
special_label
.
title
)])
expect_issues_list_count
(
1
)
expect_filtered_search_input_empty
end
...
...
@@ -297,7 +310,7 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"label:~
#{
new_label
.
title
}
"
)
expect_tokens
([
{
name:
'label'
,
value:
new_label
.
title
}
])
expect_tokens
([
label_token
(
new_label
.
title
)
])
expect_no_issues_list
()
expect_filtered_search_input_empty
end
...
...
@@ -311,25 +324,27 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"label:~'
#{
special_multiple_label
.
title
}
'"
)
# filtered search defaults quotations to double quotes
expect_tokens
([{
name:
'label'
,
value:
"
\"
#{
special_multiple_label
.
title
}
\"
"
}])
# Check for search results (which makes sure that the page has changed)
expect_issues_list_count
(
1
)
# filtered search defaults quotations to double quotes
expect_tokens
([
label_token
(
"
\"
#{
special_multiple_label
.
title
}
\"
"
)])
expect_filtered_search_input_empty
end
it
'single quotes'
do
input_filtered_search
(
"label:~'
#{
multiple_words_label
.
title
}
'"
)
expect_tokens
([{
name:
'label'
,
value:
"
\"
#{
multiple_words_label
.
title
}
\"
"
}])
expect_issues_list_count
(
1
)
expect_tokens
([
label_token
(
"
\"
#{
multiple_words_label
.
title
}
\"
"
)])
expect_filtered_search_input_empty
end
it
'double quotes'
do
input_filtered_search
(
"label:~
\"
#{
multiple_words_label
.
title
}
\"
"
)
expect_tokens
([
{
name:
'label'
,
value:
"
\"
#{
multiple_words_label
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
multiple_words_label
.
title
}
\"
"
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input_empty
end
...
...
@@ -341,7 +356,7 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"label:~'
#{
double_quotes_label
.
title
}
'"
)
expect_tokens
([
{
name:
'label'
,
value:
"'
#{
double_quotes_label
.
title
}
'"
}
])
expect_tokens
([
label_token
(
"'
#{
double_quotes_label
.
title
}
'"
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input_empty
end
...
...
@@ -353,7 +368,7 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"label:~
\"
#{
single_quotes_label
.
title
}
\"
"
)
expect_tokens
([
{
name:
'label'
,
value:
"
\"
#{
single_quotes_label
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
single_quotes_label
.
title
}
\"
"
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input_empty
end
...
...
@@ -363,7 +378,7 @@ describe 'Filter issues', js: true do
it
'filters issues by searched label and text'
do
input_filtered_search
(
"label:~
#{
caps_sensitive_label
.
title
}
#{
search_term
}
"
)
expect_tokens
([
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
])
expect_tokens
([
label_token
(
caps_sensitive_label
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
end
...
...
@@ -371,10 +386,9 @@ describe 'Filter issues', js: true do
it
'filters issues by searched label, author and text'
do
input_filtered_search
(
"label:~
#{
caps_sensitive_label
.
title
}
author:@
#{
user
.
username
}
#{
search_term
}
"
)
expect_tokens
([
{
name:
'label'
,
value:
caps_sensitive_label
.
title
},
{
name:
'author'
,
value:
user
.
username
}
])
wait_for_requests
expect_tokens
([
label_token
(
caps_sensitive_label
.
title
),
author_token
(
user
.
name
)])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
end
...
...
@@ -382,10 +396,12 @@ describe 'Filter issues', js: true do
it
'filters issues by searched label, author, assignee and text'
do
input_filtered_search
(
"label:~
#{
caps_sensitive_label
.
title
}
author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
,
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'assignee'
,
value:
user
.
username
}
label_token
(
caps_sensitive_label
.
title
)
,
author_token
(
user
.
name
)
,
assignee_token
(
user
.
name
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -395,10 +411,10 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"label:~
#{
caps_sensitive_label
.
title
}
author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
milestone:%
#{
milestone
.
title
}
#{
search_term
}
"
)
expect_tokens
([
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
,
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'assignee'
,
value:
user
.
username
}
,
{
name:
'milestone'
,
value:
milestone
.
title
}
label_token
(
caps_sensitive_label
.
title
)
,
author_token
(
user
.
name
)
,
assignee_token
(
user
.
name
)
,
milestone_token
(
milestone
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -410,8 +426,8 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"label:~
#{
bug_label
.
title
}
label:~
#{
caps_sensitive_label
.
title
}
#{
search_term
}
"
)
expect_tokens
([
{
name:
'label'
,
value:
bug_label
.
title
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
label_token
(
bug_label
.
title
)
,
label_token
(
caps_sensitive_label
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -420,10 +436,12 @@ describe 'Filter issues', js: true do
it
'filters issues by searched label, label2, author and text'
do
input_filtered_search
(
"label:~
#{
bug_label
.
title
}
label:~
#{
caps_sensitive_label
.
title
}
author:@
#{
user
.
username
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'label'
,
value:
bug_label
.
title
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
,
{
name:
'author'
,
value:
user
.
username
}
label_token
(
bug_label
.
title
)
,
label_token
(
caps_sensitive_label
.
title
)
,
author_token
(
user
.
name
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -432,11 +450,13 @@ describe 'Filter issues', js: true do
it
'filters issues by searched label, label2, author, assignee and text'
do
input_filtered_search
(
"label:~
#{
bug_label
.
title
}
label:~
#{
caps_sensitive_label
.
title
}
author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'label'
,
value:
bug_label
.
title
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
,
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'assignee'
,
value:
user
.
username
}
label_token
(
bug_label
.
title
)
,
label_token
(
caps_sensitive_label
.
title
)
,
author_token
(
user
.
name
)
,
assignee_token
(
user
.
name
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -445,12 +465,14 @@ describe 'Filter issues', js: true do
it
'filters issues by searched label, label2, author, assignee, milestone and text'
do
input_filtered_search
(
"label:~
#{
bug_label
.
title
}
label:~
#{
caps_sensitive_label
.
title
}
author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
milestone:%
#{
milestone
.
title
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'label'
,
value:
bug_label
.
title
}
,
{
name:
'label'
,
value:
caps_sensitive_label
.
title
}
,
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'assignee'
,
value:
user
.
username
}
,
{
name:
'milestone'
,
value:
milestone
.
title
}
label_token
(
bug_label
.
title
)
,
label_token
(
caps_sensitive_label
.
title
)
,
author_token
(
user
.
name
)
,
assignee_token
(
user
.
name
)
,
milestone_token
(
milestone
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -467,7 +489,7 @@ describe 'Filter issues', js: true do
end
it
'displays in search bar'
do
expect_tokens
([
{
name:
'label'
,
value:
"
\"
#{
multiple_words_label
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
multiple_words_label
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
end
...
...
@@ -484,7 +506,7 @@ describe 'Filter issues', js: true do
it
'filters issues by searched milestone'
do
input_filtered_search
(
"milestone:%
#{
milestone
.
title
}
"
)
expect_tokens
([
{
name:
'milestone'
,
value:
milestone
.
title
}
])
expect_tokens
([
milestone_token
(
milestone
.
title
)
])
expect_issues_list_count
(
5
)
expect_filtered_search_input_empty
end
...
...
@@ -492,7 +514,7 @@ describe 'Filter issues', js: true do
it
'filters issues by no milestone'
do
input_filtered_search
(
"milestone:none"
)
expect_tokens
([
{
name:
'milestone'
,
value:
'none'
}
])
expect_tokens
([
milestone_token
(
'none'
,
false
)
])
expect_issues_list_count
(
7
,
1
)
expect_filtered_search_input_empty
end
...
...
@@ -500,7 +522,7 @@ describe 'Filter issues', js: true do
it
'filters issues by upcoming milestones'
do
input_filtered_search
(
"milestone:upcoming"
)
expect_tokens
([
{
name:
'milestone'
,
value:
'upcoming'
}
])
expect_tokens
([
milestone_token
(
'upcoming'
,
false
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input_empty
end
...
...
@@ -508,7 +530,7 @@ describe 'Filter issues', js: true do
it
'filters issues by started milestones'
do
input_filtered_search
(
"milestone:started"
)
expect_tokens
([
{
name:
'milestone'
,
value:
'started'
}
])
expect_tokens
([
milestone_token
(
'started'
,
false
)
])
expect_issues_list_count
(
5
)
expect_filtered_search_input_empty
end
...
...
@@ -527,7 +549,7 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"milestone:%
#{
special_milestone
.
title
}
"
)
expect_tokens
([
{
name:
'milestone'
,
value:
special_milestone
.
title
}
])
expect_tokens
([
milestone_token
(
special_milestone
.
title
)
])
expect_issues_list_count
(
1
)
expect_filtered_search_input_empty
end
...
...
@@ -537,7 +559,7 @@ describe 'Filter issues', js: true do
input_filtered_search
(
"milestone:%
#{
new_milestone
.
title
}
"
)
expect_tokens
([
{
name:
'milestone'
,
value:
new_milestone
.
title
}
])
expect_tokens
([
milestone_token
(
new_milestone
.
title
)
])
expect_no_issues_list
()
expect_filtered_search_input_empty
end
...
...
@@ -549,7 +571,7 @@ describe 'Filter issues', js: true do
it
'filters issues by searched milestone and text'
do
input_filtered_search
(
"milestone:%
#{
milestone
.
title
}
#{
search_term
}
"
)
expect_tokens
([
{
name:
'milestone'
,
value:
milestone
.
title
}
])
expect_tokens
([
milestone_token
(
milestone
.
title
)
])
expect_issues_list_count
(
2
)
expect_filtered_search_input
(
search_term
)
end
...
...
@@ -557,9 +579,11 @@ describe 'Filter issues', js: true do
it
'filters issues by searched milestone, author and text'
do
input_filtered_search
(
"milestone:%
#{
milestone
.
title
}
author:@
#{
user
.
username
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'milestone'
,
value:
milestone
.
title
}
,
{
name:
'author'
,
value:
user
.
username
}
milestone_token
(
milestone
.
title
)
,
author_token
(
user
.
name
)
])
expect_issues_list_count
(
2
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -568,10 +592,12 @@ describe 'Filter issues', js: true do
it
'filters issues by searched milestone, author, assignee and text'
do
input_filtered_search
(
"milestone:%
#{
milestone
.
title
}
author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'milestone'
,
value:
milestone
.
title
}
,
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'assignee'
,
value:
user
.
username
}
milestone_token
(
milestone
.
title
)
,
author_token
(
user
.
name
)
,
assignee_token
(
user
.
name
)
])
expect_issues_list_count
(
2
)
expect_filtered_search_input
(
search_term
)
...
...
@@ -580,11 +606,13 @@ describe 'Filter issues', js: true do
it
'filters issues by searched milestone, author, assignee, label and text'
do
input_filtered_search
(
"milestone:%
#{
milestone
.
title
}
author:@
#{
user
.
username
}
assignee:@
#{
user
.
username
}
label:~
#{
bug_label
.
title
}
#{
search_term
}
"
)
wait_for_requests
expect_tokens
([
{
name:
'milestone'
,
value:
milestone
.
title
}
,
{
name:
'author'
,
value:
user
.
username
}
,
{
name:
'assignee'
,
value:
user
.
username
}
,
{
name:
'label'
,
value:
bug_label
.
title
}
milestone_token
(
milestone
.
title
)
,
author_token
(
user
.
name
)
,
assignee_token
(
user
.
name
)
,
label_token
(
bug_label
.
title
)
])
expect_issues_list_count
(
2
)
expect_filtered_search_input
(
search_term
)
...
...
spec/features/issues/filtered_search/search_bar_spec.rb
View file @
b84d6efa
...
...
@@ -32,7 +32,7 @@ describe 'Search bar', js: true do
it
'selects item'
do
filtered_search
.
native
.
send_keys
(
:down
,
:down
,
:enter
)
expect_tokens
([
{
name:
'author'
}
])
expect_tokens
([
author_token
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/visual_tokens_spec.rb
View file @
b84d6efa
...
...
@@ -346,8 +346,8 @@ describe 'Visual tokens', js: true do
it
'tokenizes the search term to complete visual token'
do
expect_tokens
([
{
name:
'author'
,
value:
'@root'
}
,
{
name:
'assignee'
,
value:
'none'
}
author_token
(
user
.
name
)
,
assignee_token
(
'none'
)
])
end
end
...
...
spec/features/merge_requests/filter_by_milestone_spec.rb
View file @
b84d6efa
...
...
@@ -25,7 +25,7 @@ feature 'Merge Request filtering by Milestone' do
visit_merge_requests
(
project
)
input_filtered_search
(
'milestone:none'
)
expect_tokens
([
{
name:
'milestone'
,
value:
'none'
}
])
expect_tokens
([
milestone_token
(
'none'
,
false
)
])
expect_filtered_search_input_empty
expect
(
page
).
to
have_issuable_counts
(
open:
1
,
closed:
0
,
all:
1
)
...
...
spec/features/merge_requests/filter_merge_requests_spec.rb
View file @
b84d6efa
...
...
@@ -24,7 +24,9 @@ describe 'Filter merge requests' do
let
(
:search_query
)
{
"assignee:@
#{
user
.
username
}
"
}
def
expect_assignee_visual_tokens
expect_tokens
([{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
...
...
@@ -57,7 +59,7 @@ describe 'Filter merge requests' do
let
(
:search_query
)
{
"milestone:%
\"
#{
milestone
.
title
}
\"
"
}
def
expect_milestone_visual_tokens
expect_tokens
([
{
name:
'milestone'
,
value:
"%
\"
#{
milestone
.
title
}
\"
"
}
])
expect_tokens
([
milestone_token
(
"
\"
#{
milestone
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -91,7 +93,7 @@ describe 'Filter merge requests' do
input_filtered_search
(
'label:none'
)
expect_mr_list_count
(
1
)
expect_tokens
([
{
name:
'label'
,
value:
'none'
}
])
expect_tokens
([
label_token
(
'none'
,
false
)
])
expect_filtered_search_input_empty
end
...
...
@@ -99,7 +101,7 @@ describe 'Filter merge requests' do
input_filtered_search
(
"label:~
#{
label
.
title
}
"
)
expect_mr_list_count
(
0
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
label
.
title
}
"
}
])
expect_tokens
([
label_token
(
label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -107,10 +109,7 @@ describe 'Filter merge requests' do
input_filtered_search
(
"label:~
\"
#{
wontfix
.
title
}
\"
label:~
#{
label
.
title
}
"
)
expect_mr_list_count
(
0
)
expect_tokens
([
{
name:
'label'
,
value:
"~
\"
#{
wontfix
.
title
}
\"
"
},
{
name:
'label'
,
value:
"~
#{
label
.
title
}
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
wontfix
.
title
}
\"
"
),
label_token
(
label
.
title
)])
expect_filtered_search_input_empty
end
...
...
@@ -118,16 +117,13 @@ describe 'Filter merge requests' do
input_filtered_search
(
"label:~
\"
#{
wontfix
.
title
}
\"
"
)
expect_mr_list_count
(
0
)
expect_tokens
([
{
name:
'label'
,
value:
"~
\"
#{
wontfix
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
wontfix
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
input_filtered_search_keys
(
"label:~
#{
label
.
title
}
"
)
expect_mr_list_count
(
0
)
expect_tokens
([
{
name:
'label'
,
value:
"~
\"
#{
wontfix
.
title
}
\"
"
},
{
name:
'label'
,
value:
"~
#{
label
.
title
}
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
wontfix
.
title
}
\"
"
),
label_token
(
label
.
title
)])
expect_filtered_search_input_empty
end
end
...
...
@@ -143,10 +139,9 @@ describe 'Filter merge requests' do
context
'assignee and label'
,
js:
true
do
def
expect_assignee_label_visual_tokens
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
},
{
name:
'label'
,
value:
"~
#{
label
.
title
}
"
}
])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
),
label_token
(
label
.
title
)])
expect_filtered_search_input_empty
end
...
...
@@ -214,7 +209,7 @@ describe 'Filter merge requests' do
input_filtered_search_keys
(
' label:~bug'
)
expect_mr_list_count
(
1
)
expect_tokens
([
{
name:
'label'
,
value:
'~bug'
}
])
expect_tokens
([
label_token
(
'bug'
)
])
expect_filtered_search_input
(
'Bug'
)
end
...
...
@@ -227,7 +222,7 @@ describe 'Filter merge requests' do
input_filtered_search_keys
(
' milestone:%8'
)
expect_mr_list_count
(
1
)
expect_tokens
([
{
name:
'milestone'
,
value:
'%8'
}
])
expect_tokens
([
milestone_token
(
'8'
)
])
expect_filtered_search_input
(
'Bug'
)
end
...
...
@@ -240,7 +235,10 @@ describe 'Filter merge requests' do
input_filtered_search_keys
(
" assignee:@
#{
user
.
username
}
"
)
expect_mr_list_count
(
1
)
expect_tokens
([{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input
(
'Bug'
)
end
...
...
@@ -252,8 +250,10 @@ describe 'Filter merge requests' do
input_filtered_search_keys
(
" author:@
#{
user
.
username
}
"
)
wait_for_requests
expect_mr_list_count
(
1
)
expect_tokens
([
{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
author_token
(
user
.
name
)
])
expect_filtered_search_input
(
'Bug'
)
end
end
...
...
@@ -293,7 +293,9 @@ describe 'Filter merge requests' do
it
'filter by current user'
do
visit
project_merge_requests_path
(
project
,
assignee_id:
user
.
id
)
expect_tokens
([{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
...
...
@@ -303,7 +305,9 @@ describe 'Filter merge requests' do
visit
project_merge_requests_path
(
project
,
assignee_id:
new_user
.
id
)
expect_tokens
([{
name:
'assignee'
,
value:
"@
#{
new_user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
assignee_token
(
new_user
.
name
)])
expect_filtered_search_input_empty
end
end
...
...
@@ -312,7 +316,9 @@ describe 'Filter merge requests' do
it
'filter by current user'
do
visit
project_merge_requests_path
(
project
,
author_id:
user
.
id
)
expect_tokens
([{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
author_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
...
...
@@ -322,7 +328,9 @@ describe 'Filter merge requests' do
visit
project_merge_requests_path
(
project
,
author_id:
new_user
.
id
)
expect_tokens
([{
name:
'author'
,
value:
"@
#{
new_user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
author_token
(
new_user
.
name
)])
expect_filtered_search_input_empty
end
end
...
...
spec/features/search_spec.rb
View file @
b84d6efa
...
...
@@ -195,37 +195,33 @@ describe "Search" do
it
'takes user to her issues page when issues assigned is clicked'
do
find
(
'.dropdown-menu'
).
click_link
'Issues assigned to me'
sleep
2
expect
(
page
).
to
have_selector
(
'.filtered-search'
)
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
assignee_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
it
'takes user to her issues page when issues authored is clicked'
do
find
(
'.dropdown-menu'
).
click_link
"Issues I've created"
sleep
2
expect
(
page
).
to
have_selector
(
'.filtered-search'
)
expect_tokens
([
{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
author_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
it
'takes user to her MR page when MR assigned is clicked'
do
find
(
'.dropdown-menu'
).
click_link
'Merge requests assigned to me'
sleep
2
expect
(
page
).
to
have_selector
(
'.merge-requests-holder'
)
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
assignee_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
it
'takes user to her MR page when MR authored is clicked'
do
find
(
'.dropdown-menu'
).
click_link
"Merge requests I've created"
sleep
2
expect
(
page
).
to
have_selector
(
'.merge-requests-holder'
)
expect_tokens
([
{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
author_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/support/filtered_search_helpers.rb
View file @
b84d6efa
...
...
@@ -54,8 +54,8 @@ module FilteredSearchHelpers
# Iterates through each visual token inside
# .tokens-container to make sure the correct names and values are rendered
def
expect_tokens
(
tokens
)
page
.
find
'.filtered-search-box .tokens-container'
do
page
.
all
(
:css
,
'.tokens-container li'
).
each_with_index
do
|
el
,
index
|
page
.
within
'.filtered-search-box .tokens-container'
do
page
.
all
(
:css
,
'.tokens-container li
.selectable
'
).
each_with_index
do
|
el
,
index
|
token_name
=
tokens
[
index
][
:name
]
token_value
=
tokens
[
index
][
:value
]
...
...
@@ -67,6 +67,28 @@ module FilteredSearchHelpers
end
end
def
create_token
(
token_name
,
token_value
=
nil
,
symbol
=
nil
)
{
name:
token_name
,
value:
"
#{
symbol
}#{
token_value
}
"
}
end
def
author_token
(
author_name
=
nil
)
create_token
(
'Author'
,
author_name
)
end
def
assignee_token
(
assignee_name
=
nil
)
create_token
(
'Assignee'
,
assignee_name
)
end
def
milestone_token
(
milestone_name
=
nil
,
has_symbol
=
true
)
symbol
=
has_symbol
?
'%'
:
nil
create_token
(
'Milestone'
,
milestone_name
,
symbol
)
end
def
label_token
(
label_name
=
nil
,
has_symbol
=
true
)
symbol
=
has_symbol
?
'~'
:
nil
create_token
(
'Label'
,
label_name
,
symbol
)
end
def
default_placeholder
'Search or filter results...'
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment