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
47002037
Commit
47002037
authored
Mar 09, 2022
by
Serhii Yarynovskyi
Committed by
Vitali Tatarintev
Mar 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace issuable sort dropdown
parent
f9c2abce
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
118 additions
and
77 deletions
+118
-77
app/helpers/sorting_helper.rb
app/helpers/sorting_helper.rb
+45
-0
app/views/shared/issuable/_sort_dropdown.html.haml
app/views/shared/issuable/_sort_dropdown.html.haml
+5
-22
ee/app/helpers/ee/sorting_helper.rb
ee/app/helpers/ee/sorting_helper.rb
+21
-0
ee/app/views/shared/ee/issuable/_sort_dropdown.html.haml
ee/app/views/shared/ee/issuable/_sort_dropdown.html.haml
+0
-5
spec/features/dashboard/issues_filter_spec.rb
spec/features/dashboard/issues_filter_spec.rb
+2
-2
spec/features/dashboard/merge_requests_spec.rb
spec/features/dashboard/merge_requests_spec.rb
+7
-4
spec/features/issuables/sorting_list_spec.rb
spec/features/issuables/sorting_list_spec.rb
+2
-2
spec/features/issues/filtered_search/filter_issues_spec.rb
spec/features/issues/filtered_search/filter_issues_spec.rb
+1
-1
spec/features/issues/user_sorts_issues_spec.rb
spec/features/issues/user_sorts_issues_spec.rb
+6
-9
spec/features/merge_requests/user_lists_merge_requests_spec.rb
...features/merge_requests/user_lists_merge_requests_spec.rb
+7
-7
spec/features/merge_requests/user_sorts_merge_requests_spec.rb
...features/merge_requests/user_sorts_merge_requests_spec.rb
+9
-20
spec/features/user_sorts_things_spec.rb
spec/features/user_sorts_things_spec.rb
+5
-5
spec/support/helpers/features/sorting_helpers.rb
spec/support/helpers/features/sorting_helpers.rb
+8
-0
No files found.
app/helpers/sorting_helper.rb
View file @
47002037
...
@@ -243,6 +243,51 @@ module SortingHelper
...
@@ -243,6 +243,51 @@ module SortingHelper
sort_options_hash
[
sort_value
]
sort_options_hash
[
sort_value
]
end
end
def
issuable_sort_options
(
viewing_issues
,
viewing_merge_requests
)
options
=
[
{
value:
sort_value_priority
,
text:
sort_title_priority
,
href:
page_filter_path
(
sort:
sort_value_priority
)
},
{
value:
sort_value_created_date
,
text:
sort_title_created_date
,
href:
page_filter_path
(
sort:
sort_value_created_date
)
},
{
value:
sort_value_recently_updated
,
text:
sort_title_recently_updated
,
href:
page_filter_path
(
sort:
sort_value_recently_updated
)
},
{
value:
sort_value_milestone
,
text:
sort_title_milestone
,
href:
page_filter_path
(
sort:
sort_value_milestone
)
}
]
options
.
concat
([
due_date_option
])
if
viewing_issues
options
.
concat
([
popularity_option
,
label_priority_option
])
options
.
concat
([
merged_option
,
closed_option
])
if
viewing_merge_requests
options
.
concat
([
relative_position_option
])
if
viewing_issues
options
.
concat
([
title_option
])
end
def
due_date_option
{
value:
sort_value_due_date
,
text:
sort_title_due_date
,
href:
page_filter_path
(
sort:
sort_value_due_date
)
}
end
def
popularity_option
{
value:
sort_value_popularity
,
text:
sort_title_popularity
,
href:
page_filter_path
(
sort:
sort_value_popularity
)
}
end
def
label_priority_option
{
value:
sort_value_label_priority
,
text:
sort_title_label_priority
,
href:
page_filter_path
(
sort:
sort_value_label_priority
)
}
end
def
merged_option
{
value:
sort_value_merged_date
,
text:
sort_title_merged_date
,
href:
page_filter_path
(
sort:
sort_value_merged_date
)
}
end
def
closed_option
{
value:
sort_value_closed_date
,
text:
sort_title_closed_date
,
href:
page_filter_path
(
sort:
sort_value_closed_date
)
}
end
def
relative_position_option
{
value:
sort_value_relative_position
,
text:
sort_title_relative_position
,
href:
page_filter_path
(
sort:
sort_value_relative_position
)
}
end
def
title_option
{
value:
sort_value_title
,
text:
sort_title_title
,
href:
page_filter_path
(
sort:
sort_value_title
)
}
end
def
sort_direction_icon
(
sort_value
)
def
sort_direction_icon
(
sort_value
)
case
sort_value
case
sort_value
when
sort_value_milestone
,
sort_value_due_date
,
sort_value_merged_date
,
sort_value_closed_date
,
/_asc\z/
when
sort_value_milestone
,
sort_value_due_date
,
sort_value_merged_date
,
sort_value_closed_date
,
/_asc\z/
...
...
app/views/shared/issuable/_sort_dropdown.html.haml
View file @
47002037
-
sort_value
=
@sort
-
sort_title
=
issuable_sort_option_title
(
sort_value
)
-
viewing_issues
=
controller
.
controller_name
==
'issues'
||
controller
.
action_name
==
'issues'
-
viewing_issues
=
controller
.
controller_name
==
'issues'
||
controller
.
action_name
==
'issues'
-
viewing_merge_requests
=
controller
.
controller_name
==
'merge_requests'
-
viewing_merge_requests
=
controller
.
controller_name
==
'merge_requests'
-
items
=
issuable_sort_options
(
viewing_issues
,
viewing_merge_requests
)
-
selected
=
issuable_sort_option_overrides
[
@sort
]
||
@sort
.
dropdown.inline.gl-ml-3.issue-sort-dropdown
.
gl-ml-3
.btn-group
{
role:
'group'
}
.btn-group
{
role:
'group'
}
.btn-group
{
role:
'group'
}
=
gl_redirect_listbox_tag
(
items
,
selected
,
data:
{
right:
true
})
%button
.dropdown-menu-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
,
display:
'static'
},
class:
'gl-button btn btn-default'
}
=
issuable_sort_direction_button
(
@sort
)
=
sort_title
=
sprite_icon
(
'chevron-down'
,
css_class:
"dropdown-menu-toggle-icon gl-top-3"
)
%ul
.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
%li
=
sortable_item
(
sort_title_priority
,
page_filter_path
(
sort:
sort_value_priority
),
sort_title
)
=
sortable_item
(
sort_title_created_date
,
page_filter_path
(
sort:
sort_value_created_date
),
sort_title
)
=
sortable_item
(
sort_title_recently_updated
,
page_filter_path
(
sort:
sort_value_recently_updated
),
sort_title
)
=
sortable_item
(
sort_title_milestone
,
page_filter_path
(
sort:
sort_value_milestone
),
sort_title
)
=
sortable_item
(
sort_title_due_date
,
page_filter_path
(
sort:
sort_value_due_date
),
sort_title
)
if
viewing_issues
=
sortable_item
(
sort_title_popularity
,
page_filter_path
(
sort:
sort_value_popularity
),
sort_title
)
=
sortable_item
(
sort_title_label_priority
,
page_filter_path
(
sort:
sort_value_label_priority
),
sort_title
)
=
sortable_item
(
sort_title_merged_date
,
page_filter_path
(
sort:
sort_value_merged_date
),
sort_title
)
if
viewing_merge_requests
=
sortable_item
(
sort_title_closed_date
,
page_filter_path
(
sort:
sort_value_closed_date
),
sort_title
)
if
viewing_merge_requests
=
sortable_item
(
sort_title_relative_position
,
page_filter_path
(
sort:
sort_value_relative_position
),
sort_title
)
if
viewing_issues
=
sortable_item
(
sort_title_title
,
page_filter_path
(
sort:
sort_value_title
),
sort_title
)
=
render_if_exists
(
'shared/ee/issuable/sort_dropdown'
,
viewing_issues:
viewing_issues
,
sort_title:
sort_title
)
=
issuable_sort_direction_button
(
sort_value
)
ee/app/helpers/ee/sorting_helper.rb
View file @
47002037
...
@@ -37,5 +37,26 @@ module EE
...
@@ -37,5 +37,26 @@ module EE
super
super
end
end
end
end
override
:issuable_sort_options
def
issuable_sort_options
(
viewing_issues
,
viewing_merge_requests
)
options
=
super
if
viewing_issues
&&
(
@project
||
@group
)
&
.
licensed_feature_available?
(
:issue_weights
)
options
.
concat
([
weight_option
])
end
options
.
concat
([
blocking_option
])
if
viewing_issues
options
end
def
weight_option
{
value:
sort_value_weight
,
text:
sort_title_weight
,
href:
page_filter_path
(
sort:
sort_value_weight
)
}
end
def
blocking_option
{
value:
sort_value_blocking_desc
,
text:
sort_title_blocking
,
href:
page_filter_path
(
sort:
sort_value_blocking_desc
)
}
end
end
end
end
end
ee/app/views/shared/ee/issuable/_sort_dropdown.html.haml
deleted
100644 → 0
View file @
f9c2abce
-
allow_weight_sort
=
viewing_issues
&&
(
@project
||
@group
)
&
.
feature_available?
(
:issue_weights
)
=
sortable_item
(
sort_title_weight
,
page_filter_path
(
sort:
sort_value_weight
),
sort_title
)
if
allow_weight_sort
-
allow_blocking_sort
=
viewing_issues
=
sortable_item
(
sort_title_blocking
,
page_filter_path
(
sort:
sort_value_blocking_desc
),
sort_title
)
if
allow_blocking_sort
spec/features/dashboard/issues_filter_spec.rb
View file @
47002037
...
@@ -78,14 +78,14 @@ RSpec.describe 'Dashboard Issues filtering', :js do
...
@@ -78,14 +78,14 @@ RSpec.describe 'Dashboard Issues filtering', :js do
end
end
it
'remembers last sorting value'
do
it
'remembers last sorting value'
do
sort_by
(
'Created date'
)
pajamas_sort_by
(
s_
(
'SortOptions|Created date'
)
)
visit_issues
(
assignee_username:
user
.
username
)
visit_issues
(
assignee_username:
user
.
username
)
expect
(
page
).
to
have_button
(
'Created date'
)
expect
(
page
).
to
have_button
(
'Created date'
)
end
end
it
'keeps sorting issues after visiting Projects Issues page'
do
it
'keeps sorting issues after visiting Projects Issues page'
do
sort_by
(
'Created date'
)
pajamas_sort_by
(
s_
(
'SortOptions|Created date'
)
)
visit
project_issues_path
(
project
)
visit
project_issues_path
(
project
)
expect
(
page
).
to
have_button
(
'Created date'
)
expect
(
page
).
to
have_button
(
'Created date'
)
...
...
spec/features/dashboard/merge_requests_spec.rb
View file @
47002037
...
@@ -115,6 +115,9 @@ RSpec.describe 'Dashboard Merge Requests' do
...
@@ -115,6 +115,9 @@ RSpec.describe 'Dashboard Merge Requests' do
within
(
"span[aria-label='
#{
n_
(
"%d merge request"
,
"%d merge requests"
,
3
)
%
3
}
']"
)
do
within
(
"span[aria-label='
#{
n_
(
"%d merge request"
,
"%d merge requests"
,
3
)
%
3
}
']"
)
do
expect
(
page
).
to
have_content
(
'3'
)
expect
(
page
).
to
have_content
(
'3'
)
end
end
find
(
'.dashboard-shortcuts-merge_requests'
).
click
expect
(
find
(
'.js-assigned-mr-count'
)).
to
have_content
(
'2'
)
expect
(
find
(
'.js-assigned-mr-count'
)).
to
have_content
(
'2'
)
expect
(
find
(
'.js-reviewer-mr-count'
)).
to
have_content
(
'1'
)
expect
(
find
(
'.js-reviewer-mr-count'
)).
to
have_content
(
'1'
)
end
end
...
@@ -165,16 +168,16 @@ RSpec.describe 'Dashboard Merge Requests' do
...
@@ -165,16 +168,16 @@ RSpec.describe 'Dashboard Merge Requests' do
expect
(
page
).
to
have_content
(
'Please select at least one filter to see results'
)
expect
(
page
).
to
have_content
(
'Please select at least one filter to see results'
)
end
end
it
'shows sorted merge requests'
do
it
'shows sorted merge requests'
,
:js
do
sort_by
(
'Created date'
)
pajamas_sort_by
(
s_
(
'SortOptions|Created date'
)
)
visit
merge_requests_dashboard_path
(
assignee_username:
current_user
.
username
)
visit
merge_requests_dashboard_path
(
assignee_username:
current_user
.
username
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
end
end
it
'keeps sorting merge requests after visiting Projects MR page'
do
it
'keeps sorting merge requests after visiting Projects MR page'
,
:js
do
sort_by
(
'Created date'
)
pajamas_sort_by
(
s_
(
'SortOptions|Created date'
)
)
visit
project_merge_requests_path
(
project
)
visit
project_merge_requests_path
(
project
)
...
...
spec/features/issuables/sorting_list_spec.rb
View file @
47002037
...
@@ -88,14 +88,14 @@ RSpec.describe 'Sort Issuable List' do
...
@@ -88,14 +88,14 @@ RSpec.describe 'Sort Issuable List' do
end
end
end
end
context
'custom sorting'
do
context
'custom sorting'
,
:js
do
let
(
:issuable_type
)
{
:merge_request
}
let
(
:issuable_type
)
{
:merge_request
}
it
'supports sorting in asc and desc order'
do
it
'supports sorting in asc and desc order'
do
visit_merge_requests_with_state
(
project
,
'open'
)
visit_merge_requests_with_state
(
project
,
'open'
)
click_button
(
'Created date'
)
click_button
(
'Created date'
)
click_link
(
'Updated date'
)
find
(
'.dropdown-item'
,
text:
'Updated date'
).
click
expect
(
first_merge_request
).
to
include
(
last_updated_issuable
.
title
)
expect
(
first_merge_request
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_updated_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_updated_issuable
.
title
)
...
...
spec/features/issues/filtered_search/filter_issues_spec.rb
View file @
47002037
...
@@ -556,7 +556,7 @@ RSpec.describe 'Filter issues', :js do
...
@@ -556,7 +556,7 @@ RSpec.describe 'Filter issues', :js do
sort_toggle
=
find
(
'.filter-dropdown-container .dropdown'
)
sort_toggle
=
find
(
'.filter-dropdown-container .dropdown'
)
sort_toggle
.
click
sort_toggle
.
click
find
(
'.
filter-dropdown-container .dropdown-menu li a
'
,
text:
'Created date'
).
click
find
(
'.
dropdown-item
'
,
text:
'Created date'
).
click
wait_for_requests
wait_for_requests
expect
(
find
(
'.issues-list .issue:first-of-type .issue-title-text a'
)).
to
have_content
(
new_issue
.
title
)
expect
(
find
(
'.issues-list .issue:first-of-type .issue-title-text a'
)).
to
have_content
(
new_issue
.
title
)
...
...
spec/features/issues/user_sorts_issues_spec.rb
View file @
47002037
...
@@ -5,6 +5,7 @@ require "spec_helper"
...
@@ -5,6 +5,7 @@ require "spec_helper"
RSpec
.
describe
"User sorts issues"
do
RSpec
.
describe
"User sorts issues"
do
include
SortingHelper
include
SortingHelper
include
IssueHelpers
include
IssueHelpers
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
...
@@ -24,26 +25,22 @@ RSpec.describe "User sorts issues" do
...
@@ -24,26 +25,22 @@ RSpec.describe "User sorts issues" do
sign_in
(
user
)
sign_in
(
user
)
end
end
it
'keeps the sort option'
do
it
'keeps the sort option'
,
:js
do
visit
(
project_issues_path
(
project
))
visit
(
project_issues_path
(
project
))
find
(
'.filter-dropdown-container .dropdown'
).
click
pajamas_sort_by
(
s_
(
'SortOptions|Milestone'
))
page
.
within
(
'ul.dropdown-menu.dropdown-menu-right li'
)
do
click_link
(
'Milestone'
)
end
visit
(
issues_dashboard_path
(
assignee_username:
user
.
username
))
visit
(
issues_dashboard_path
(
assignee_username:
user
.
username
))
expect
(
find
(
'.
issues-filters a.is-activ
e'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.
filter-dropdown-container button.dropdown-toggl
e'
)).
to
have_content
(
'Milestone'
)
visit
(
project_issues_path
(
project
))
visit
(
project_issues_path
(
project
))
expect
(
find
(
'.
issues-filters a.is-activ
e'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.
filter-dropdown-container button.dropdown-toggl
e'
)).
to
have_content
(
'Milestone'
)
visit
(
issues_group_path
(
group
))
visit
(
issues_group_path
(
group
))
expect
(
find
(
'.
issues-filters a.is-activ
e'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.
filter-dropdown-container button.dropdown-toggl
e'
)).
to
have_content
(
'Milestone'
)
end
end
it
'sorts by popularity'
,
:js
do
it
'sorts by popularity'
,
:js
do
...
...
spec/features/merge_requests/user_lists_merge_requests_spec.rb
View file @
47002037
...
@@ -109,7 +109,7 @@ RSpec.describe 'Merge requests > User lists merge requests' do
...
@@ -109,7 +109,7 @@ RSpec.describe 'Merge requests > User lists merge requests' do
expect
(
count_merge_requests
).
to
eq
(
4
)
expect
(
count_merge_requests
).
to
eq
(
4
)
end
end
it
'sorts by milestone'
do
it
'sorts by milestone
due date
'
do
visit_merge_requests
(
project
,
sort:
sort_value_milestone
)
visit_merge_requests
(
project
,
sort:
sort_value_milestone
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
...
@@ -130,12 +130,12 @@ RSpec.describe 'Merge requests > User lists merge requests' do
...
@@ -130,12 +130,12 @@ RSpec.describe 'Merge requests > User lists merge requests' do
expect
(
count_merge_requests
).
to
eq
(
4
)
expect
(
count_merge_requests
).
to
eq
(
4
)
end
end
it
'filters on one label and sorts by due date'
do
it
'filters on one label and sorts by
milestone
due date'
do
label
=
create
(
:label
,
project:
project
)
label
=
create
(
:label
,
project:
project
)
create
(
:label_link
,
label:
label
,
target:
@fix
)
create
(
:label_link
,
label:
label
,
target:
@fix
)
visit_merge_requests
(
project
,
label_name:
[
label
.
name
],
visit_merge_requests
(
project
,
label_name:
[
label
.
name
],
sort:
sort_value_
due_dat
e
)
sort:
sort_value_
mileston
e
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
count_merge_requests
).
to
eq
(
1
)
expect
(
count_merge_requests
).
to
eq
(
1
)
...
@@ -150,19 +150,19 @@ RSpec.describe 'Merge requests > User lists merge requests' do
...
@@ -150,19 +150,19 @@ RSpec.describe 'Merge requests > User lists merge requests' do
create
(
:label_link
,
label:
label2
,
target:
@fix
)
create
(
:label_link
,
label:
label2
,
target:
@fix
)
end
end
it
'sorts by due date'
do
it
'sorts by
milestone
due date'
do
visit_merge_requests
(
project
,
label_name:
[
label
.
name
,
label2
.
name
],
visit_merge_requests
(
project
,
label_name:
[
label
.
name
,
label2
.
name
],
sort:
sort_value_
due_dat
e
)
sort:
sort_value_
mileston
e
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
count_merge_requests
).
to
eq
(
1
)
expect
(
count_merge_requests
).
to
eq
(
1
)
end
end
context
'filter on assignee and'
do
context
'filter on assignee and'
do
it
'sorts by
due soon
'
do
it
'sorts by
milestone due date
'
do
visit_merge_requests
(
project
,
label_name:
[
label
.
name
,
label2
.
name
],
visit_merge_requests
(
project
,
label_name:
[
label
.
name
,
label2
.
name
],
assignee_id:
user
.
id
,
assignee_id:
user
.
id
,
sort:
sort_value_
due_dat
e
)
sort:
sort_value_
mileston
e
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
count_merge_requests
).
to
eq
(
1
)
expect
(
count_merge_requests
).
to
eq
(
1
)
...
...
spec/features/merge_requests/user_sorts_merge_requests_spec.rb
View file @
47002037
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'User sorts merge requests'
do
RSpec
.
describe
'User sorts merge requests'
,
:js
do
include
CookieHelper
include
CookieHelper
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let!
(
:merge_request2
)
do
let!
(
:merge_request2
)
do
...
@@ -22,23 +23,19 @@ RSpec.describe 'User sorts merge requests' do
...
@@ -22,23 +23,19 @@ RSpec.describe 'User sorts merge requests' do
end
end
it
'keeps the sort option'
do
it
'keeps the sort option'
do
find
(
'.filter-dropdown-container .dropdown'
).
click
pajamas_sort_by
(
s_
(
'SortOptions|Milestone'
))
page
.
within
(
'ul.dropdown-menu.dropdown-menu-right li'
)
do
click_link
(
'Milestone'
)
end
visit
(
merge_requests_dashboard_path
(
assignee_username:
user
.
username
))
visit
(
merge_requests_dashboard_path
(
assignee_username:
user
.
username
))
expect
(
find
(
'.
issues-filters a.is-activ
e'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.
filter-dropdown-container button.dropdown-toggl
e'
)).
to
have_content
(
'Milestone'
)
visit
(
project_merge_requests_path
(
project
))
visit
(
project_merge_requests_path
(
project
))
expect
(
find
(
'.
issues-filters a.is-activ
e'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.
filter-dropdown-container button.dropdown-toggl
e'
)).
to
have_content
(
'Milestone'
)
visit
(
merge_requests_group_path
(
group
))
visit
(
merge_requests_group_path
(
group
))
expect
(
find
(
'.
issues-filters a.is-activ
e'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.
filter-dropdown-container button.dropdown-toggl
e'
)).
to
have_content
(
'Milestone'
)
end
end
it
'fallbacks to issuable_sort cookie key when remembering the sorting option'
do
it
'fallbacks to issuable_sort cookie key when remembering the sorting option'
do
...
@@ -46,17 +43,13 @@ RSpec.describe 'User sorts merge requests' do
...
@@ -46,17 +43,13 @@ RSpec.describe 'User sorts merge requests' do
visit
(
merge_requests_dashboard_path
(
assignee_username:
user
.
username
))
visit
(
merge_requests_dashboard_path
(
assignee_username:
user
.
username
))
expect
(
find
(
'.
issues-filters a.is-activ
e'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.
filter-dropdown-container button.dropdown-toggl
e'
)).
to
have_content
(
'Milestone'
)
end
end
it
'separates remember sorting with issues'
do
it
'separates remember sorting with issues'
do
create
(
:issue
,
project:
project
)
create
(
:issue
,
project:
project
)
find
(
'.filter-dropdown-container .dropdown'
).
click
pajamas_sort_by
(
s_
(
'SortOptions|Milestone'
))
page
.
within
(
'ul.dropdown-menu.dropdown-menu-right li'
)
do
click_link
(
'Milestone'
)
end
visit
(
project_issues_path
(
project
))
visit
(
project_issues_path
(
project
))
...
@@ -73,11 +66,7 @@ RSpec.describe 'User sorts merge requests' do
...
@@ -73,11 +66,7 @@ RSpec.describe 'User sorts merge requests' do
end
end
it
'sorts by popularity'
do
it
'sorts by popularity'
do
find
(
'.filter-dropdown-container .dropdown'
).
click
pajamas_sort_by
(
s_
(
'SortOptions|Popularity'
))
page
.
within
(
'ul.dropdown-menu.dropdown-menu-right li'
)
do
click_link
(
'Popularity'
)
end
page
.
within
(
'.mr-list'
)
do
page
.
within
(
'.mr-list'
)
do
page
.
within
(
'li.merge-request:nth-child(1)'
)
do
page
.
within
(
'li.merge-request:nth-child(1)'
)
do
...
...
spec/features/user_sorts_things_spec.rb
View file @
47002037
...
@@ -6,7 +6,7 @@ require "spec_helper"
...
@@ -6,7 +6,7 @@ require "spec_helper"
# to check if the sorting option set by user is being kept persisted while going through pages.
# to check if the sorting option set by user is being kept persisted while going through pages.
# The `it`s are named here by convention `starting point -> some pages -> final point`.
# The `it`s are named here by convention `starting point -> some pages -> final point`.
# All those specs are moved out to this spec intentionally to keep them all in one place.
# All those specs are moved out to this spec intentionally to keep them all in one place.
RSpec
.
describe
"User sorts things"
do
RSpec
.
describe
"User sorts things"
,
:js
do
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
include
DashboardHelper
include
DashboardHelper
...
@@ -21,11 +21,11 @@ RSpec.describe "User sorts things" do
...
@@ -21,11 +21,11 @@ RSpec.describe "User sorts things" do
end
end
it
"issues -> project home page -> issues"
do
it
"issues -> project home page -> issues"
do
sort_option
=
'Updated date'
sort_option
=
s_
(
'SortOptions|Updated date'
)
visit
(
project_issues_path
(
project
))
visit
(
project_issues_path
(
project
))
sort_by
(
sort_option
)
pajamas_
sort_by
(
sort_option
)
visit
(
project_path
(
project
))
visit
(
project_path
(
project
))
visit
(
project_issues_path
(
project
))
visit
(
project_issues_path
(
project
))
...
@@ -34,11 +34,11 @@ RSpec.describe "User sorts things" do
...
@@ -34,11 +34,11 @@ RSpec.describe "User sorts things" do
end
end
it
"merge requests -> dashboard merge requests"
do
it
"merge requests -> dashboard merge requests"
do
sort_option
=
'Updated date'
sort_option
=
s_
(
'SortOptions|Updated date'
)
visit
(
project_merge_requests_path
(
project
))
visit
(
project_merge_requests_path
(
project
))
sort_by
(
sort_option
)
pajamas_
sort_by
(
sort_option
)
visit
(
assigned_mrs_dashboard_path
)
visit
(
assigned_mrs_dashboard_path
)
...
...
spec/support/helpers/features/sorting_helpers.rb
View file @
47002037
...
@@ -21,6 +21,14 @@ module Spec
...
@@ -21,6 +21,14 @@ module Spec
click_link
(
value
)
click_link
(
value
)
end
end
end
end
# pajamas_sort_by is used to sort new pajamas dropdowns. When
# all of the dropdowns are converted, pajamas_sort_by can be renamed to sort_by
# https://gitlab.com/groups/gitlab-org/-/epics/7551
def
pajamas_sort_by
(
value
)
find
(
'.filter-dropdown-container .dropdown'
).
click
find
(
'.dropdown-item'
,
text:
value
).
click
end
end
end
end
end
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