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