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
9b361a3f
Commit
9b361a3f
authored
Sep 23, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take filters in account in issuable counters
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
f9887a10
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
141 additions
and
133 deletions
+141
-133
CHANGELOG
CHANGELOG
+1
-0
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+5
-10
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+8
-11
app/views/shared/issuable/_nav.html.haml
app/views/shared/issuable/_nav.html.haml
+10
-10
spec/features/dashboard_issues_spec.rb
spec/features/dashboard_issues_spec.rb
+15
-0
spec/features/issues/filter_by_labels_spec.rb
spec/features/issues/filter_by_labels_spec.rb
+36
-97
spec/features/issues/filter_issues_spec.rb
spec/features/issues/filter_issues_spec.rb
+51
-5
spec/features/merge_requests/filter_by_milestone_spec.rb
spec/features/merge_requests/filter_by_milestone_spec.rb
+15
-0
No files found.
CHANGELOG
View file @
9b361a3f
...
@@ -12,6 +12,7 @@ v 8.13.0 (unreleased)
...
@@ -12,6 +12,7 @@ v 8.13.0 (unreleased)
- Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison)
- Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison)
- Use a ConnectionPool for Rails.cache on Sidekiq servers
- Use a ConnectionPool for Rails.cache on Sidekiq servers
- Only update issuable labels if they have been changed
- Only update issuable labels if they have been changed
- Take filters in account in issuable counters. !6496
- Revoke button in Applications Settings underlines on hover.
- Revoke button in Applications Settings underlines on hover.
- Fix Long commit messages overflow viewport in file tree
- Fix Long commit messages overflow viewport in file tree
- Update ruby-prof to 0.16.2. !6026 (Elan Ruusamäe)
- Update ruby-prof to 0.16.2. !6026 (Elan Ruusamäe)
...
...
app/finders/issuable_finder.rb
View file @
9b361a3f
...
@@ -183,17 +183,12 @@ class IssuableFinder
...
@@ -183,17 +183,12 @@ class IssuableFinder
end
end
def
by_state
(
items
)
def
by_state
(
items
)
case
params
[
:state
]
params
[
:state
]
||=
'all'
when
'closed'
items
.
closed
if
items
.
respond_to?
(
params
[
:state
])
when
'merged'
items
.
public_send
(
params
[
:state
])
items
.
respond_to?
(
:merged
)
?
items
.
merged
:
items
.
closed
when
'all'
items
when
'opened'
items
.
opened
else
else
raise
'You must specify default state'
items
end
end
end
end
...
...
app/helpers/application_helper.rb
View file @
9b361a3f
...
@@ -280,27 +280,24 @@ module ApplicationHelper
...
@@ -280,27 +280,24 @@ module ApplicationHelper
end
end
end
end
def
state_filters_text_for
(
entity
,
project
)
def
issuables_state_counter_text
(
state
,
issuables
)
titles
=
{
titles
=
{
opened:
"Open"
opened:
"Open"
}
}
entity_title
=
titles
[
entity
]
||
entity
.
to_s
.
humanize
state_title
=
titles
[
state
]
||
state
.
to_s
.
humanize
count
=
count
=
if
project
.
nil?
if
@issues
||
@merge_requests
nil
issuables_finder
=
@issues
?
issues_finder
:
merge_requests_finder
elsif
current_controller?
(
:issues
)
issuables_finder
.
params
[
:state
]
=
state
project
.
issues
.
visible_to_user
(
current_user
).
send
(
entity
).
count
issuables_finder
.
execute
.
page
(
1
).
total_count
elsif
current_controller?
(
:merge_requests
)
project
.
merge_requests
.
send
(
entity
).
count
end
end
html
=
content_tag
:span
,
entity_title
html
=
content_tag
(
:span
,
state_title
)
if
count
.
present?
if
count
.
present?
html
+=
" "
html
<<
" "
<<
content_tag
(
:span
,
number_with_delimiter
(
count
),
class:
'badge'
)
html
+=
content_tag
:span
,
number_with_delimiter
(
count
),
class:
'badge'
end
end
html
.
html_safe
html
.
html_safe
...
...
app/views/shared/issuable/_nav.html.haml
View file @
9b361a3f
-
type
=
local_assigns
.
fetch
(
:type
,
:issues
)
-
page_context_word
=
type
.
to_s
.
humanize
(
capitalize:
false
)
-
issuables
=
@issues
||
@merge_requests
%ul
.nav-links.issues-state-filters
%ul
.nav-links.issues-state-filters
-
if
defined?
(
type
)
&&
type
==
:merge_requests
-
page_context_word
=
'merge requests'
-
else
-
page_context_word
=
'issues'
%li
{
class:
(
"active"
if
params
[
:state
]
==
'opened'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'opened'
)}
=
link_to
page_filter_path
(
state:
'opened'
,
label:
true
),
title:
"Filter by
#{
page_context_word
}
that are currently opened."
do
=
link_to
page_filter_path
(
state:
'opened'
,
label:
true
),
title:
"Filter by
#{
page_context_word
}
that are currently opened."
do
#{
state_filters_text_for
(
:opened
,
@project
)
}
#{
issuables_state_counter_text
(
:opened
,
issuables
)
}
-
if
defined?
(
type
)
&&
type
==
:merge_requests
-
if
type
==
:merge_requests
%li
{
class:
(
"active"
if
params
[
:state
]
==
'merged'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'merged'
)}
=
link_to
page_filter_path
(
state:
'merged'
,
label:
true
),
title:
'Filter by merge requests that are currently merged.'
do
=
link_to
page_filter_path
(
state:
'merged'
,
label:
true
),
title:
'Filter by merge requests that are currently merged.'
do
#{
state_filters_text_for
(
:merged
,
@project
)
}
#{
issuables_state_counter_text
(
:merged
,
issuables
)
}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
=
link_to
page_filter_path
(
state:
'closed'
,
label:
true
),
title:
'Filter by merge requests that are currently closed and unmerged.'
do
=
link_to
page_filter_path
(
state:
'closed'
,
label:
true
),
title:
'Filter by merge requests that are currently closed and unmerged.'
do
#{
state_filters_text_for
(
:closed
,
@project
)
}
#{
issuables_state_counter_text
(
:closed
,
issuables
)
}
-
else
-
else
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
=
link_to
page_filter_path
(
state:
'closed'
,
label:
true
),
title:
'Filter by issues that are currently closed.'
do
=
link_to
page_filter_path
(
state:
'closed'
,
label:
true
),
title:
'Filter by issues that are currently closed.'
do
#{
state_filters_text_for
(
:closed
,
@project
)
}
#{
issuables_state_counter_text
(
:closed
,
issuables
)
}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'all'
)}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'all'
)}
=
link_to
page_filter_path
(
state:
'all'
,
label:
true
),
title:
"Show all
#{
page_context_word
}
."
do
=
link_to
page_filter_path
(
state:
'all'
,
label:
true
),
title:
"Show all
#{
page_context_word
}
."
do
#{
state_filters_text_for
(
:all
,
@project
)
}
#{
issuables_state_counter_text
(
:all
,
issuables
)
}
spec/features/dashboard_issues_spec.rb
View file @
9b361a3f
...
@@ -21,6 +21,11 @@ describe "Dashboard Issues filtering", feature: true, js: true do
...
@@ -21,6 +21,11 @@ describe "Dashboard Issues filtering", feature: true, js: true do
click_link
'No Milestone'
click_link
'No Milestone'
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
end
end
...
@@ -29,6 +34,11 @@ describe "Dashboard Issues filtering", feature: true, js: true do
...
@@ -29,6 +34,11 @@ describe "Dashboard Issues filtering", feature: true, js: true do
click_link
'Any Milestone'
click_link
'Any Milestone'
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 2'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 2'
)
end
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
end
end
...
@@ -39,6 +49,11 @@ describe "Dashboard Issues filtering", feature: true, js: true do
...
@@ -39,6 +49,11 @@ describe "Dashboard Issues filtering", feature: true, js: true do
click_link
milestone
.
title
click_link
milestone
.
title
end
end
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
end
end
end
end
...
...
spec/features/issues/filter_by_labels_spec.rb
View file @
9b361a3f
require
'rails_helper'
require
'rails_helper'
feature
'Issue filtering by Labels'
,
feature:
true
do
feature
'Issue filtering by Labels'
,
feature:
true
,
js:
true
do
include
WaitForAjax
include
WaitForAjax
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
before
do
before
do
...
@@ -28,156 +28,85 @@ feature 'Issue filtering by Labels', feature: true do
...
@@ -28,156 +28,85 @@ feature 'Issue filtering by Labels', feature: true do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
end
end
context
'filter by label bug'
,
js:
true
do
context
'filter by label bug'
do
before
do
before
do
page
.
find
(
'.js-label-select'
).
click
select_labels
(
'bug'
)
wait_for_ajax
execute_script
(
"$('.dropdown-menu-labels li:contains(
\"
bug
\"
) a').click()"
)
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
wait_for_ajax
end
end
it
'
shows issue "Bugfix1" and "Bugfix2" in issues list
'
do
it
'
apply the filter
'
do
expect
(
page
).
to
have_content
"Bugfix1"
expect
(
page
).
to
have_content
"Bugfix1"
expect
(
page
).
to
have_content
"Bugfix2"
expect
(
page
).
to
have_content
"Bugfix2"
end
it
'does not show "Feature1" in issues list'
do
expect
(
page
).
not_to
have_content
"Feature1"
expect
(
page
).
not_to
have_content
"Feature1"
end
it
'shows label "bug" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"bug"
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"bug"
end
it
'does not show label "feature" and "enhancement" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"feature"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"feature"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"enhancement"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"enhancement"
end
it
'removes label "bug"'
do
find
(
'.js-label-filter-remove'
).
click
find
(
'.js-label-filter-remove'
).
click
wait_for_ajax
wait_for_ajax
expect
(
find
(
'.filtered-labels'
,
visible:
false
)).
to
have_no_content
"bug"
expect
(
find
(
'.filtered-labels'
,
visible:
false
)).
to
have_no_content
"bug"
end
end
end
end
context
'filter by label feature'
,
js:
true
do
context
'filter by label feature'
do
before
do
before
do
page
.
find
(
'.js-label-select'
).
click
select_labels
(
'feature'
)
wait_for_ajax
execute_script
(
"$('.dropdown-menu-labels li:contains(
\"
feature
\"
) a').click()"
)
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
wait_for_ajax
end
end
it
'
shows issue "Feature1" in issues list
'
do
it
'
applies the filter
'
do
expect
(
page
).
to
have_content
"Feature1"
expect
(
page
).
to
have_content
"Feature1"
end
it
'does not show "Bugfix1" and "Bugfix2" in issues list'
do
expect
(
page
).
not_to
have_content
"Bugfix2"
expect
(
page
).
not_to
have_content
"Bugfix2"
expect
(
page
).
not_to
have_content
"Bugfix1"
expect
(
page
).
not_to
have_content
"Bugfix1"
end
it
'shows label "feature" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"feature"
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"feature"
end
it
'does not show label "bug" and "enhancement" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"bug"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"bug"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"enhancement"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"enhancement"
end
end
end
end
context
'filter by label enhancement'
,
js:
true
do
context
'filter by label enhancement'
do
before
do
before
do
page
.
find
(
'.js-label-select'
).
click
select_labels
(
'enhancement'
)
wait_for_ajax
execute_script
(
"$('.dropdown-menu-labels li:contains(
\"
enhancement
\"
) a').click()"
)
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
wait_for_ajax
end
end
it
'
shows issue "Bugfix2" in issues list
'
do
it
'
applies the filter
'
do
expect
(
page
).
to
have_content
"Bugfix2"
expect
(
page
).
to
have_content
"Bugfix2"
end
it
'does not show "Feature1" and "Bugfix1" in issues list'
do
expect
(
page
).
not_to
have_content
"Feature1"
expect
(
page
).
not_to
have_content
"Feature1"
expect
(
page
).
not_to
have_content
"Bugfix1"
expect
(
page
).
not_to
have_content
"Bugfix1"
end
it
'shows label "enhancement" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"enhancement"
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"enhancement"
end
it
'does not show label "feature" and "bug" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"bug"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"bug"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"feature"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"feature"
end
end
end
end
context
'filter by label enhancement
or feature'
,
js:
true
do
context
'filter by label enhancement
and bug in issues list'
do
before
do
before
do
page
.
find
(
'.js-label-select'
).
click
select_labels
(
'bug'
,
'enhancement'
)
wait_for_ajax
execute_script
(
"$('.dropdown-menu-labels li:contains(
\"
enhancement
\"
) a').click()"
)
execute_script
(
"$('.dropdown-menu-labels li:contains(
\"
feature
\"
) a').click()"
)
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
wait_for_ajax
end
end
it
'does not show "Bugfix1" or "Feature1" in issues list'
do
it
'applies the filters'
do
expect
(
page
).
not_to
have_content
"Bugfix1"
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
expect
(
page
).
to
have_content
"Bugfix2"
expect
(
page
).
not_to
have_content
"Feature1"
expect
(
page
).
not_to
have_content
"Feature1"
end
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"bug"
it
'shows label "enhancement" and "feature" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"enhancement"
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"enhancement"
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"feature"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"feature"
end
it
'does not show label "bug" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"bug"
end
it
'removes label "enhancement"'
do
find
(
'.js-label-filter-remove'
,
match: :first
).
click
find
(
'.js-label-filter-remove'
,
match: :first
).
click
wait_for_ajax
wait_for_ajax
expect
(
find
(
'.filtered-labels'
)).
to
have_no_content
"enhancement"
end
end
context
'filter by label enhancement and bug in issues list'
,
js:
true
do
before
do
page
.
find
(
'.js-label-select'
).
click
wait_for_ajax
execute_script
(
"$('.dropdown-menu-labels li:contains(
\"
enhancement
\"
) a').click()"
)
execute_script
(
"$('.dropdown-menu-labels li:contains(
\"
bug
\"
) a').click()"
)
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
wait_for_ajax
end
it
'shows issue "Bugfix2" in issues list'
do
expect
(
page
).
to
have_content
"Bugfix2"
expect
(
page
).
to
have_content
"Bugfix2"
end
it
'does not show "Feature1"'
do
expect
(
page
).
not_to
have_content
"Feature1"
expect
(
page
).
not_to
have_content
"Feature1"
end
expect
(
page
).
not_to
have_content
"Bugfix1"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"bug"
it
'shows label "bug" and "enhancement" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"bug"
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"enhancement"
expect
(
find
(
'.filtered-labels'
)).
to
have_content
"enhancement"
end
it
'does not show label "feature" in filtered-labels'
do
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"feature"
expect
(
find
(
'.filtered-labels'
)).
not_to
have_content
"feature"
end
end
end
end
context
'remove filtered labels'
,
js:
true
do
context
'remove filtered labels'
do
before
do
before
do
page
.
within
'.labels-filter'
do
page
.
within
'.labels-filter'
do
click_button
'Label'
click_button
'Label'
...
@@ -200,7 +129,7 @@ feature 'Issue filtering by Labels', feature: true do
...
@@ -200,7 +129,7 @@ feature 'Issue filtering by Labels', feature: true do
end
end
end
end
context
'dropdown filtering'
,
js:
true
do
context
'dropdown filtering'
do
it
'filters by label name'
do
it
'filters by label name'
do
page
.
within
'.labels-filter'
do
page
.
within
'.labels-filter'
do
click_button
'Label'
click_button
'Label'
...
@@ -214,4 +143,14 @@ feature 'Issue filtering by Labels', feature: true do
...
@@ -214,4 +143,14 @@ feature 'Issue filtering by Labels', feature: true do
end
end
end
end
end
end
def
select_labels
(
*
labels
)
page
.
find
(
'.js-label-select'
).
click
wait_for_ajax
labels
.
each
do
|
label
|
execute_script
(
"$('.dropdown-menu-labels li:contains(
\"
#{
label
}
\"
) a').click()"
)
end
page
.
first
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
wait_for_ajax
end
end
end
spec/features/issues/filter_issues_spec.rb
View file @
9b361a3f
...
@@ -7,15 +7,15 @@ describe 'Filter issues', feature: true do
...
@@ -7,15 +7,15 @@ describe 'Filter issues', feature: true do
let!
(
:user
)
{
create
(
:user
)}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:wontfix
)
{
create
(
:label
,
project:
project
,
title:
"Won't fix"
)
}
let!
(
:wontfix
)
{
create
(
:label
,
project:
project
,
title:
"Won't fix"
)
}
before
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
login_as
(
user
)
create
(
:issue
,
project:
project
)
end
end
describe
'
Filter issues
for assignee from issues#index'
do
describe
'for assignee from issues#index'
do
before
do
before
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
...
@@ -45,7 +45,7 @@ describe 'Filter issues', feature: true do
...
@@ -45,7 +45,7 @@ describe 'Filter issues', feature: true do
end
end
end
end
describe
'
Filter issues
for milestone from issues#index'
do
describe
'for milestone from issues#index'
do
before
do
before
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
...
@@ -75,7 +75,7 @@ describe 'Filter issues', feature: true do
...
@@ -75,7 +75,7 @@ describe 'Filter issues', feature: true do
end
end
end
end
describe
'
Filter issues
for label from issues#index'
,
js:
true
do
describe
'for label from issues#index'
,
js:
true
do
before
do
before
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
find
(
'.js-label-select'
).
click
find
(
'.js-label-select'
).
click
...
@@ -115,6 +115,7 @@ describe 'Filter issues', feature: true do
...
@@ -115,6 +115,7 @@ describe 'Filter issues', feature: true do
expect
(
page
).
to
have_content
wontfix
.
title
expect
(
page
).
to
have_content
wontfix
.
title
click_link
wontfix
.
title
click_link
wontfix
.
title
end
end
expect
(
find
(
'.js-label-select .dropdown-toggle-text'
)).
to
have_content
(
wontfix
.
title
)
expect
(
find
(
'.js-label-select .dropdown-toggle-text'
)).
to
have_content
(
wontfix
.
title
)
end
end
...
@@ -146,7 +147,7 @@ describe 'Filter issues', feature: true do
...
@@ -146,7 +147,7 @@ describe 'Filter issues', feature: true do
end
end
end
end
describe
'
Filter issues
for assignee and label from issues#index'
do
describe
'for assignee and label from issues#index'
do
before
do
before
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
...
@@ -226,6 +227,11 @@ describe 'Filter issues', feature: true do
...
@@ -226,6 +227,11 @@ describe 'Filter issues', feature: true do
it
'filters by text and label'
do
it
'filters by text and label'
do
fill_in
'issuable_search'
,
with:
'Bug'
fill_in
'issuable_search'
,
with:
'Bug'
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 2'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 2'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
end
end
...
@@ -236,6 +242,11 @@ describe 'Filter issues', feature: true do
...
@@ -236,6 +242,11 @@ describe 'Filter issues', feature: true do
end
end
find
(
'.dropdown-menu-close-icon'
).
click
find
(
'.dropdown-menu-close-icon'
).
click
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
end
end
...
@@ -244,6 +255,11 @@ describe 'Filter issues', feature: true do
...
@@ -244,6 +255,11 @@ describe 'Filter issues', feature: true do
it
'filters by text and milestone'
do
it
'filters by text and milestone'
do
fill_in
'issuable_search'
,
with:
'Bug'
fill_in
'issuable_search'
,
with:
'Bug'
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 2'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 2'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
end
end
...
@@ -253,6 +269,11 @@ describe 'Filter issues', feature: true do
...
@@ -253,6 +269,11 @@ describe 'Filter issues', feature: true do
click_link
'8'
click_link
'8'
end
end
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
end
end
...
@@ -261,6 +282,11 @@ describe 'Filter issues', feature: true do
...
@@ -261,6 +282,11 @@ describe 'Filter issues', feature: true do
it
'filters by text and assignee'
do
it
'filters by text and assignee'
do
fill_in
'issuable_search'
,
with:
'Bug'
fill_in
'issuable_search'
,
with:
'Bug'
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 2'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 2'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
end
end
...
@@ -270,6 +296,11 @@ describe 'Filter issues', feature: true do
...
@@ -270,6 +296,11 @@ describe 'Filter issues', feature: true do
click_link
user
.
name
click_link
user
.
name
end
end
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
end
end
...
@@ -278,6 +309,11 @@ describe 'Filter issues', feature: true do
...
@@ -278,6 +309,11 @@ describe 'Filter issues', feature: true do
it
'filters by text and author'
do
it
'filters by text and author'
do
fill_in
'issuable_search'
,
with:
'Bug'
fill_in
'issuable_search'
,
with:
'Bug'
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 2'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 2'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
end
end
...
@@ -287,6 +323,11 @@ describe 'Filter issues', feature: true do
...
@@ -287,6 +323,11 @@ describe 'Filter issues', feature: true do
click_link
user
.
name
click_link
user
.
name
end
end
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
end
end
...
@@ -315,6 +356,11 @@ describe 'Filter issues', feature: true do
...
@@ -315,6 +356,11 @@ describe 'Filter issues', feature: true do
find
(
'.dropdown-menu-close-icon'
).
click
find
(
'.dropdown-menu-close-icon'
).
click
wait_for_ajax
wait_for_ajax
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 2'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 2'
)
end
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
2
)
end
end
...
...
spec/features/merge_requests/filter_by_milestone_spec.rb
View file @
9b361a3f
...
@@ -17,6 +17,11 @@ feature 'Merge Request filtering by Milestone', feature: true do
...
@@ -17,6 +17,11 @@ feature 'Merge Request filtering by Milestone', feature: true do
visit_merge_requests
(
project
)
visit_merge_requests
(
project
)
filter_by_milestone
(
Milestone
::
None
.
title
)
filter_by_milestone
(
Milestone
::
None
.
title
)
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
1
)
end
end
...
@@ -39,6 +44,11 @@ feature 'Merge Request filtering by Milestone', feature: true do
...
@@ -39,6 +44,11 @@ feature 'Merge Request filtering by Milestone', feature: true do
visit_merge_requests
(
project
)
visit_merge_requests
(
project
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
filter_by_milestone
(
Milestone
::
Upcoming
.
title
)
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
1
)
end
end
...
@@ -61,6 +71,11 @@ feature 'Merge Request filtering by Milestone', feature: true do
...
@@ -61,6 +71,11 @@ feature 'Merge Request filtering by Milestone', feature: true do
visit_merge_requests
(
project
)
visit_merge_requests
(
project
)
filter_by_milestone
(
milestone
.
title
)
filter_by_milestone
(
milestone
.
title
)
page
.
within
'.issues-state-filters'
do
expect
(
page
).
to
have_content
(
'Open 1'
)
expect
(
page
).
to
have_content
(
'Closed 0'
)
expect
(
page
).
to
have_content
(
'All 1'
)
end
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.merge-request'
,
count:
1
)
end
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