diff options
| author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-08-07 13:10:28 +0100 |
|---|---|---|
| committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-08-07 13:10:28 +0100 |
| commit | f64a7c4780e7ebd092f5cb37e09cb674d093631a (patch) | |
| tree | 0810c759a6f3c48f09f31b4e7b919ee043a7cfdb /spec/javascripts | |
| parent | ec93e17ac58ca6b79cdfd2b1848e07dc93d5c6f7 (diff) | |
| download | gitlab-ce-f64a7c4780e7ebd092f5cb37e09cb674d093631a.tar.gz | |
Remove repo_binary_viewer as it is no longer needed
Diffstat (limited to 'spec/javascripts')
| -rw-r--r-- | spec/javascripts/repo/components/repo_binary_viewer_spec.js | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/spec/javascripts/repo/components/repo_binary_viewer_spec.js b/spec/javascripts/repo/components/repo_binary_viewer_spec.js deleted file mode 100644 index 5441bb4f5a1..00000000000 --- a/spec/javascripts/repo/components/repo_binary_viewer_spec.js +++ /dev/null @@ -1,89 +0,0 @@ -import Vue from 'vue'; -import Store from '~/repo/stores/repo_store'; -import repoBinaryViewer from '~/repo/components/repo_binary_viewer.vue'; - -describe('RepoBinaryViewer', () => { - function createComponent() { - const RepoBinaryViewer = Vue.extend(repoBinaryViewer); - - return new RepoBinaryViewer().$mount(); - } - - function createActiveFile(type, activeFile = {}) { - const file = activeFile; - - switch (type) { - case 'svg': - case 'png': - file.name = 'name'; - break; - case 'md': - file.html = 'html'; - break; - default: - break; - } - - return file; - } - - function setActiveBinary(type) { - const binaryTypes = {}; - binaryTypes[type] = true; - - const activeFile = createActiveFile(type); - - const uri = 'uri'; - Store.binary = true; - Store.binaryTypes = binaryTypes; - Store.activeFile = activeFile; - Store.pngBlobWithDataURI = uri; - - return { - activeFile, - uri, - }; - } - - function assertBinaryImg(img, activeFile, uri) { - expect(img.src).toMatch(`/${uri}`); - expect(img.alt).toEqual(activeFile.name); - } - - it('renders an img if its png', () => { - const { activeFile, uri } = setActiveBinary('png'); - const vm = createComponent(); - const img = vm.$el.querySelector(':scope > img'); - - assertBinaryImg(img, activeFile, uri); - }); - - it('renders an img if its svg', () => { - const { activeFile, uri } = setActiveBinary('svg'); - const vm = createComponent(); - const img = vm.$el.querySelector(':scope > img'); - - assertBinaryImg(img, activeFile, uri); - }); - - it('renders an div with content if its markdown', () => { - const { activeFile } = setActiveBinary('md'); - const vm = createComponent(); - - expect(vm.$el.querySelector(':scope > div').innerHTML).toEqual(activeFile.html); - }); - - it('renders no preview message if its unknown', () => { - setActiveBinary('unknown'); - const vm = createComponent(); - - expect(vm.$el.querySelector('.binary-unknown').textContent).toMatch('Binary file. No preview available.'); - }); - - it('does not render if no binary', () => { - Store.binary = false; - const vm = createComponent(); - - expect(vm.$el.innerHTML).toBeFalsy(); - }); -}); |
