Commit e44bb865 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 175b4fa2
...@@ -17,7 +17,7 @@ variables: ...@@ -17,7 +17,7 @@ variables:
RAILS_ENV: "test" RAILS_ENV: "test"
NODE_ENV: "test" NODE_ENV: "test"
SIMPLECOV: "true" SIMPLECOV: "true"
GIT_DEPTH: "50" GIT_DEPTH: "20"
GIT_SUBMODULE_STRATEGY: "none" GIT_SUBMODULE_STRATEGY: "none"
GET_SOURCES_ATTEMPTS: "3" GET_SOURCES_ATTEMPTS: "3"
KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/report-master.json KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/report-master.json
......
...@@ -71,6 +71,10 @@ export default { ...@@ -71,6 +71,10 @@ export default {
}, },
methods: { methods: {
getPercent(count) { getPercent(count) {
if (!this.totalCount) {
return 0;
}
const percent = roundOffFloat((count / this.totalCount) * 100, 1); const percent = roundOffFloat((count / this.totalCount) * 100, 1);
if (percent > 0 && percent < 1) { if (percent > 0 && percent < 1) {
return '< 1'; return '< 1';
......
...@@ -53,6 +53,12 @@ describe('StackedProgressBarComponent', () => { ...@@ -53,6 +53,12 @@ describe('StackedProgressBarComponent', () => {
it('returns percentage as `< 1` from provided count based on `totalCount` when evaluated value is less than 1', () => { it('returns percentage as `< 1` from provided count based on `totalCount` when evaluated value is less than 1', () => {
expect(vm.getPercent(10)).toBe('< 1'); expect(vm.getPercent(10)).toBe('< 1');
}); });
it('returns 0 if totalCount is falsy', () => {
vm = createComponent({ totalCount: 0 });
expect(vm.getPercent(100)).toBe(0);
});
}); });
describe('barStyle', () => { describe('barStyle', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment