diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-04-27 14:37:40 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-04-27 14:37:40 +0000 |
commit | de489f972c1cbff487900be904c3c83700088b50 (patch) | |
tree | fce58f708a01974080aabb115fb0ad79a11de2ea /spec/javascripts | |
parent | 6ae76738dde8fecb117f7706ae2ef74c1d83cdb7 (diff) | |
download | gitlab-ce-de489f972c1cbff487900be904c3c83700088b50.tar.gz |
Remove unused code
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/pipelines/time_ago_spec.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/spec/javascripts/pipelines/time_ago_spec.js b/spec/javascripts/pipelines/time_ago_spec.js new file mode 100644 index 00000000000..24581e8c672 --- /dev/null +++ b/spec/javascripts/pipelines/time_ago_spec.js @@ -0,0 +1,64 @@ +import Vue from 'vue'; +import timeAgo from '~/pipelines/components/time_ago'; + +describe('Timeago component', () => { + let TimeAgo; + beforeEach(() => { + TimeAgo = Vue.extend(timeAgo); + }); + + describe('with duration', () => { + it('should render duration and timer svg', () => { + const component = new TimeAgo({ + propsData: { + duration: 10, + finishedTime: '', + }, + }).$mount(); + + expect(component.$el.querySelector('.duration')).toBeDefined(); + expect(component.$el.querySelector('.duration svg')).toBeDefined(); + }); + }); + + describe('without duration', () => { + it('should not render duration and timer svg', () => { + const component = new TimeAgo({ + propsData: { + duration: 0, + finishedTime: '', + }, + }).$mount(); + + expect(component.$el.querySelector('.duration')).toBe(null); + }); + }); + + describe('with finishedTime', () => { + it('should render time and calendar icon', () => { + const component = new TimeAgo({ + propsData: { + duration: 0, + finishedTime: '2017-04-26T12:40:23.277Z', + }, + }).$mount(); + + expect(component.$el.querySelector('.finished-at')).toBeDefined(); + expect(component.$el.querySelector('.finished-at i.fa-calendar')).toBeDefined(); + expect(component.$el.querySelector('.finished-at time')).toBeDefined(); + }); + }); + + describe('without finishedTime', () => { + it('should not render time and calendar icon', () => { + const component = new TimeAgo({ + propsData: { + duration: 0, + finishedTime: '', + }, + }).$mount(); + + expect(component.$el.querySelector('.finished-at')).toBe(null); + }); + }); +}); |