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
Boxiang Sun
gitlab-ce
Commits
60b16f46
Commit
60b16f46
authored
Aug 20, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show `< 1%` when percent value evaluated is less than 1
parent
3c80adf5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue
...avascripts/vue_shared/components/stacked_progress_bar.vue
+5
-1
spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js
...cripts/vue_shared/components/stacked_progress_bar_spec.js
+5
-1
No files found.
app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue
View file @
60b16f46
...
...
@@ -71,7 +71,11 @@ export default {
},
methods
:
{
getPercent
(
count
)
{
return
roundOffFloat
((
count
/
this
.
totalCount
)
*
100
,
1
);
const
percent
=
roundOffFloat
((
count
/
this
.
totalCount
)
*
100
,
1
);
if
(
percent
>
0
&&
percent
<
1
)
{
return
'
< 1
'
;
}
return
percent
;
},
barStyle
(
percent
)
{
return
`width:
${
percent
}
%;`
;
...
...
spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js
View file @
60b16f46
...
...
@@ -44,7 +44,11 @@ describe('StackedProgressBarComponent', () => {
});
it
(
'
returns percentage with decimal place from provided count based on `totalCount`
'
,
()
=>
{
expect
(
vm
.
getPercent
(
10
)).
toBe
(
0.2
);
expect
(
vm
.
getPercent
(
67
)).
toBe
(
1.3
);
});
it
(
'
returns percentage as `< 1` from provided count based on `totalCount` when evaluated value is less than 1
'
,
()
=>
{
expect
(
vm
.
getPercent
(
10
)).
toBe
(
'
< 1
'
);
});
});
...
...
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