diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-03 21:08:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-03 21:08:46 +0300 |
commit | 63a015fd85ae35634eb882d0078e65d80300816c (patch) | |
tree | 317928bc138d54e28980962e813004876398a7ac /spec/javascripts/vue_shared | |
parent | 55693cc1ec8ac79444bc7214d2812a4ac41bf043 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/vue_shared')
-rw-r--r-- | spec/javascripts/vue_shared/components/content_viewer/content_viewer_spec.js | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/spec/javascripts/vue_shared/components/content_viewer/content_viewer_spec.js b/spec/javascripts/vue_shared/components/content_viewer/content_viewer_spec.js index e3f6609f128..e2a1ed931f1 100644 --- a/spec/javascripts/vue_shared/components/content_viewer/content_viewer_spec.js +++ b/spec/javascripts/vue_shared/components/content_viewer/content_viewer_spec.js @@ -58,14 +58,34 @@ describe('ContentViewer', () => { it('renders fallback download control', done => { createComponent({ - path: 'test.abc', + path: 'somepath/test.abc', fileSize: 1024, }); setTimeout(() => { - expect(vm.$el.querySelector('.file-info').textContent.trim()).toContain('test.abc'); - expect(vm.$el.querySelector('.file-info').textContent.trim()).toContain('(1.00 KiB)'); - expect(vm.$el.querySelector('.btn.btn-default').textContent.trim()).toContain('Download'); + expect( + vm.$el + .querySelector('.file-info') + .textContent.trim() + .replace(/\s+/, ' '), + ).toEqual('test.abc (1.00 KiB)'); + + expect(vm.$el.querySelector('.btn.btn-default').textContent.trim()).toEqual('Download'); + + done(); + }); + }); + + it('renders fallback download control for file with a data URL path properly', done => { + createComponent({ + path: 'data:application/octet-stream;base64,U0VMRUNUICfEhHNnc2cnIGZyb20gVGFibGVuYW1lOwoK', + filePath: 'somepath/test.abc', + }); + + setTimeout(() => { + expect(vm.$el.querySelector('.file-info').textContent.trim()).toEqual('test.abc'); + expect(vm.$el.querySelector('.btn.btn-default')).toHaveAttr('download', 'test.abc'); + expect(vm.$el.querySelector('.btn.btn-default').textContent.trim()).toEqual('Download'); done(); }); |