Commit 80d1ef6b authored by Phil Hughes's avatar Phil Hughes

Fix diff files being visible in the diff file header

parent 28cfd6d0
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
diffFilesLength: { diffFilesLength: {
type: Number, type: Number,
required: false, required: false,
default: 0, default: null,
}, },
}, },
computed: { computed: {
......
...@@ -3,6 +3,18 @@ import Icon from '~/vue_shared/components/icon.vue'; ...@@ -3,6 +3,18 @@ import Icon from '~/vue_shared/components/icon.vue';
import DiffStats from '~/diffs/components/diff_stats.vue'; import DiffStats from '~/diffs/components/diff_stats.vue';
describe('diff_stats', () => { describe('diff_stats', () => {
it('does not render a group if diffFileLengths is empty', () => {
const wrapper = shallowMount(DiffStats, {
propsData: {
addedLines: 1,
removedLines: 2,
},
});
const groups = wrapper.findAll('.diff-stats-group');
expect(groups.length).toBe(2);
});
it('does not render a group if diffFileLengths is not a number', () => { it('does not render a group if diffFileLengths is not a number', () => {
const wrapper = shallowMount(DiffStats, { const wrapper = shallowMount(DiffStats, {
propsData: { propsData: {
......
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