Commit 9f9eb03f authored by Sean Nichols's avatar Sean Nichols

Fix diff table rendering for empty files and improve tests

parent ece6df18
...@@ -74,12 +74,12 @@ export default { ...@@ -74,12 +74,12 @@ export default {
<template v-if="isTextFile"> <template v-if="isTextFile">
<empty-file-viewer v-if="diffFile.empty" /> <empty-file-viewer v-if="diffFile.empty" />
<inline-diff-view <inline-diff-view
v-if="isInlineView" v-else-if="isInlineView"
:diff-file="diffFile" :diff-file="diffFile"
:diff-lines="diffFile.highlighted_diff_lines || []" :diff-lines="diffFile.highlighted_diff_lines || []"
/> />
<parallel-diff-view <parallel-diff-view
v-if="isParallelView" v-else-if="isParallelView"
:diff-file="diffFile" :diff-file="diffFile"
:diff-lines="diffFile.parallel_diff_lines || []" :diff-lines="diffFile.parallel_diff_lines || []"
/> />
......
...@@ -58,16 +58,16 @@ describe('DiffContent', () => { ...@@ -58,16 +58,16 @@ describe('DiffContent', () => {
it('should render a message', done => { it('should render a message', done => {
vm.$nextTick(() => { vm.$nextTick(() => {
expect(vm.$el.querySelector('.diff-viewer .nothing-here-block')).not.toBe(null); const block = vm.$el.querySelector('.diff-viewer .nothing-here-block');
expect(
vm.$el.querySelector('.diff-viewer .nothing-here-block').textContent.trim(), expect(block).not.toBe(null);
).toContain('Empty file'); expect(block.textContent.trim()).toContain('Empty file');
done(); done();
}); });
}); });
it('should not display multiple messages', done => { it('should not render multiple messages', done => {
vm.diffFile.mode_changed = true; vm.diffFile.mode_changed = true;
vm.diffFile.b_mode = '100755'; vm.diffFile.b_mode = '100755';
vm.diffFile.viewer.name = 'mode_changed'; vm.diffFile.viewer.name = 'mode_changed';
...@@ -78,6 +78,14 @@ describe('DiffContent', () => { ...@@ -78,6 +78,14 @@ describe('DiffContent', () => {
done(); done();
}); });
}); });
it('should not render diff table', done => {
vm.$nextTick(() => {
expect(vm.$el.querySelector('table')).toBe(null);
done();
});
});
}); });
describe('Non-Text diffs', () => { describe('Non-Text diffs', () => {
......
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