summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-11 21:08:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-11 21:08:17 +0000
commite44bb86539a8fb4cfb06dfe281632b6f206bd0a7 (patch)
treef2ecc1f57ba4fc0cb8570780890518519c3bbf59
parent175b4fa261259ab0d033482d10bb4159fee8e538 (diff)
downloadgitlab-ce-e44bb86539a8fb4cfb06dfe281632b6f206bd0a7.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue4
-rw-r--r--spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js6
3 files changed, 11 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 722c5043c4a..45d0dbf1c7c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,7 +17,7 @@ variables:
RAILS_ENV: "test"
NODE_ENV: "test"
SIMPLECOV: "true"
- GIT_DEPTH: "50"
+ GIT_DEPTH: "20"
GIT_SUBMODULE_STRATEGY: "none"
GET_SOURCES_ATTEMPTS: "3"
KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/report-master.json
diff --git a/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue b/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue
index af4eb2de7f8..ea564d1b2f2 100644
--- a/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue
+++ b/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue
@@ -71,6 +71,10 @@ export default {
},
methods: {
getPercent(count) {
+ if (!this.totalCount) {
+ return 0;
+ }
+
const percent = roundOffFloat((count / this.totalCount) * 100, 1);
if (percent > 0 && percent < 1) {
return '< 1';
diff --git a/spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js b/spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js
index e4db67f5b18..f226dabb8a0 100644
--- a/spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js
+++ b/spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js
@@ -53,6 +53,12 @@ describe('StackedProgressBarComponent', () => {
it('returns percentage as `< 1` from provided count based on `totalCount` when evaluated value is less than 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', () => {