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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
43ac2a96
Commit
43ac2a96
authored
Feb 26, 2019
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pagination spec and improve filtering of null values
parent
7765e6ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
app/assets/javascripts/environments/mixins/environments_mixin.js
...ets/javascripts/environments/mixins/environments_mixin.js
+6
-2
spec/features/projects/environments/environments_spec.rb
spec/features/projects/environments/environments_spec.rb
+17
-0
No files found.
app/assets/javascripts/environments/mixins/environments_mixin.js
View file @
43ac2a96
...
@@ -44,8 +44,8 @@ export default {
...
@@ -44,8 +44,8 @@ export default {
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
// Prevent the absence of the nested flag from causing mismatches
// Prevent the absence of the nested flag from causing mismatches
const
response
=
_
.
omit
(
resp
.
config
.
params
,
_
.
isUndefined
);
const
response
=
this
.
filterNilValues
(
resp
.
config
.
params
);
const
request
=
_
.
omit
(
this
.
requestData
,
_
.
isUndefined
);
const
request
=
this
.
filterNilValues
(
this
.
requestData
);
if
(
_
.
isEqual
(
response
,
request
))
{
if
(
_
.
isEqual
(
response
,
request
))
{
this
.
store
.
storeAvailableCount
(
resp
.
data
.
available_count
);
this
.
store
.
storeAvailableCount
(
resp
.
data
.
available_count
);
...
@@ -55,6 +55,10 @@ export default {
...
@@ -55,6 +55,10 @@ export default {
}
}
},
},
filterNilValues
(
obj
)
{
return
_
.
omit
(
obj
,
value
=>
_
.
isUndefined
(
value
)
||
_
.
isNull
(
value
));
},
/**
/**
* Handles URL and query parameter changes.
* Handles URL and query parameter changes.
* When the user uses the pagination or the tabs,
* When the user uses the pagination or the tabs,
...
...
spec/features/projects/environments/environments_spec.rb
View file @
43ac2a96
...
@@ -38,6 +38,23 @@ describe 'Environments page', :js do
...
@@ -38,6 +38,23 @@ describe 'Environments page', :js do
end
end
end
end
describe
'with environments spanning multiple pages'
,
:js
do
before
do
allow
(
Kaminari
.
config
).
to
receive
(
:default_per_page
).
and_return
(
3
)
create_list
(
:environment
,
4
,
project:
project
,
state: :available
)
end
it
'should render second page of pipelines'
do
visit_environments
(
project
,
scope:
'available'
)
find
(
'.js-next-button'
).
click
wait_for_requests
expect
(
page
).
to
have_selector
(
'.gl-pagination .page'
,
count:
2
)
expect
(
find
(
'.gl-pagination .page-item.active .page-link'
).
text
).
to
eq
(
"2"
)
end
end
describe
'in stopped tab page'
do
describe
'in stopped tab page'
do
it
'should show no environments'
do
it
'should show no environments'
do
visit_environments
(
project
,
scope:
'stopped'
)
visit_environments
(
project
,
scope:
'stopped'
)
...
...
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