diff options
author | Sean Nichols <git@seanich.com> | 2018-12-13 01:49:32 -0500 |
---|---|---|
committer | Sean Nichols <git@seanich.com> | 2018-12-13 01:49:32 -0500 |
commit | 4d2448e03a4f73edc785bd89620fa8c5efdf3def (patch) | |
tree | 031b43fa794ecfb072c1d0b91f8c279fa8592c4c /spec/javascripts | |
parent | 4ae1591b9768f8f727048ff83f675fe99a10eb90 (diff) | |
download | gitlab-ce-4d2448e03a4f73edc785bd89620fa8c5efdf3def.tar.gz |
Add tests and move empty file message into own component
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/diffs/components/diff_content_spec.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/javascripts/diffs/components/diff_content_spec.js b/spec/javascripts/diffs/components/diff_content_spec.js index c25f6167163..a63960b3567 100644 --- a/spec/javascripts/diffs/components/diff_content_spec.js +++ b/spec/javascripts/diffs/components/diff_content_spec.js @@ -49,6 +49,37 @@ describe('DiffContent', () => { }); }); + describe('empty files', () => { + beforeEach(() => { + vm.diffFile.empty = true; + vm.diffFile.highlighted_diff_lines = []; + vm.diffFile.parallel_diff_lines = []; + }); + + 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'); + + done(); + }); + }); + + it('should not display multiple messages', done => { + vm.diffFile.mode_changed = true; + vm.diffFile.b_mode = '100755'; + vm.diffFile.viewer.name = 'mode_changed'; + + vm.$nextTick(() => { + expect(vm.$el.querySelectorAll('.nothing-here-block').length).toBe(1); + + done(); + }); + }); + }); + describe('Non-Text diffs', () => { beforeEach(() => { vm.diffFile.viewer.name = 'image'; |