diff options
author | Phil Hughes <me@iamphill.com> | 2018-01-19 11:52:41 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-01-19 11:52:41 +0000 |
commit | bd24529131484f6daee150303f634c2f2f901767 (patch) | |
tree | 97a60cefd7c69163c3e39b33ab02e0f0d6ae1d5e /spec | |
parent | e4952f1703f6a5ad7d2ad4813dc6ccbee8daeaf9 (diff) | |
parent | bf1b26eadf3cb6f2ae8231def2c34b3fa0a704a1 (diff) | |
download | gitlab-ce-bd24529131484f6daee150303f634c2f2f901767.tar.gz |
Merge branch 'mr-widget-vue' into 'master'
Move archived component to vue file
See merge request gitlab-org/gitlab-ce!16561
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/vue_mr_widget/components/states/mr_widget_archived_spec.js | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_archived_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_archived_spec.js index 4869fb17d96..f98ebdb38e6 100644 --- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_archived_spec.js +++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_archived_spec.js @@ -1,18 +1,31 @@ import Vue from 'vue'; -import archivedComponent from '~/vue_merge_request_widget/components/states/mr_widget_archived'; +import archivedComponent from '~/vue_merge_request_widget/components/states/mr_widget_archived.vue'; +import mountComponent from '../../../helpers/vue_mount_component_helper'; describe('MRWidgetArchived', () => { - describe('template', () => { - it('should have correct elements', () => { - const Component = Vue.extend(archivedComponent); - const el = new Component({ - el: document.createElement('div'), - }).$el; + let vm; - expect(el.classList.contains('mr-widget-body')).toBeTruthy(); - expect(el.querySelector('button').classList.contains('btn-success')).toBeTruthy(); - expect(el.querySelector('button').disabled).toBeTruthy(); - expect(el.innerText).toContain('This project is archived, write access has been disabled'); - }); + beforeEach(() => { + const Component = Vue.extend(archivedComponent); + vm = mountComponent(Component); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it('renders a ci status failed icon', () => { + expect(vm.$el.querySelector('.ci-status-icon')).not.toBeNull(); + }); + + it('renders a disabled button', () => { + expect(vm.$el.querySelector('button').getAttribute('disabled')).toEqual('disabled'); + expect(vm.$el.querySelector('button').textContent.trim()).toEqual('Merge'); + }); + + it('renders information', () => { + expect( + vm.$el.querySelector('.bold').textContent.trim(), + ).toEqual('This project is archived, write access has been disabled'); }); }); |