diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-11 12:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-11 12:09:45 +0300 |
commit | c7ba7b997608a103a0a9165b2e5cef9530c4ef53 (patch) | |
tree | 3af88eaacba25539b97da4ad358418b6a69c11d7 /spec/frontend/vue_shared/components/ci_icon_spec.js | |
parent | a031b1f4f34470fba578856dc7ab735a6f54733a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared/components/ci_icon_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/ci_icon_spec.js | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/ci_icon_spec.js b/spec/frontend/vue_shared/components/ci_icon_spec.js new file mode 100644 index 00000000000..63afe631063 --- /dev/null +++ b/spec/frontend/vue_shared/components/ci_icon_spec.js @@ -0,0 +1,122 @@ +import Vue from 'vue'; +import mountComponent from 'helpers/vue_mount_component_helper'; +import ciIcon from '~/vue_shared/components/ci_icon.vue'; + +describe('CI Icon component', () => { + const Component = Vue.extend(ciIcon); + let vm; + + afterEach(() => { + vm.$destroy(); + }); + + it('should render a span element with an svg', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_success', + }, + }); + + expect(vm.$el.tagName).toEqual('SPAN'); + expect(vm.$el.querySelector('span > svg')).toBeDefined(); + }); + + it('should render a success status', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_success', + group: 'success', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-success')).toEqual(true); + }); + + it('should render a failed status', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_failed', + group: 'failed', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-failed')).toEqual(true); + }); + + it('should render success with warnings status', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_warning', + group: 'warning', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-warning')).toEqual(true); + }); + + it('should render pending status', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_pending', + group: 'pending', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-pending')).toEqual(true); + }); + + it('should render running status', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_running', + group: 'running', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-running')).toEqual(true); + }); + + it('should render created status', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_created', + group: 'created', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-created')).toEqual(true); + }); + + it('should render skipped status', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_skipped', + group: 'skipped', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-skipped')).toEqual(true); + }); + + it('should render canceled status', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_canceled', + group: 'canceled', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-canceled')).toEqual(true); + }); + + it('should render status for manual action', () => { + vm = mountComponent(Component, { + status: { + icon: 'status_manual', + group: 'manual', + }, + }); + + expect(vm.$el.classList.contains('ci-status-icon-manual')).toEqual(true); + }); +}); |