提交 5566588f 编写于 作者: F Filipa Lacerda

Merge branch '6028-show-generic-percent-stacked-progress-bar' into 'master'

Show `< 1%` when percent value evaluated is less than 1 on Stacked Progress Bar

Closes gitlab-ee#6028

See merge request gitlab-org/gitlab-ce!21306
......@@ -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}%;`;
......
---
title: Show '< 1%' when percent value evaluated is less than 1 on Stacked Progress
Bar
merge_request: 21306
author:
type: fixed
......@@ -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');
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册