diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-05-12 14:47:58 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-05-16 15:11:55 +0300 |
commit | 9f8000790426e6c013dcb828c997a7dd72f5e3e1 (patch) | |
tree | e5848a4afcbcd80b88e745dc531a6f68e5449a64 /spec/javascripts/vue_mr_widget/components | |
parent | a2dbb69331ad13c77986bc2c4ed64298d5bc1388 (diff) |
MRWidget: Fix specs and address WIP comments.
Diffstat (limited to 'spec/javascripts/vue_mr_widget/components')
-rw-r--r-- | spec/javascripts/vue_mr_widget/components/states/mr_widget_nothing_to_merge_spec.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_nothing_to_merge_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_nothing_to_merge_spec.js index d40c67b189d..0d632c7f4e5 100644 --- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_nothing_to_merge_spec.js +++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_nothing_to_merge_spec.js @@ -4,14 +4,26 @@ import nothingToMergeComponent from '~/vue_merge_request_widget/components/state describe('MRWidgetNothingToMerge', () => { describe('template', () => { const Component = Vue.extend(nothingToMergeComponent); + const newBlobPath = '/foo'; const vm = new Component({ el: document.createElement('div'), + propsData: { + mr: { newBlobPath }, + }, }); + it('should have correct elements', () => { expect(vm.$el.classList.contains('mr-widget-body')).toBeTruthy(); - expect(vm.$el.querySelector('button').getAttribute('disabled')).toBeTruthy(); - expect(vm.$el.innerText).toContain('There is nothing to merge from source branch into target branch.'); + expect(vm.$el.querySelector('a').href).toContain(newBlobPath); + expect(vm.$el.innerText).toContain("Currently there are no changes in this merge request's source branch"); expect(vm.$el.innerText).toContain('Please push new commits or use a different branch.'); }); + + it('should not show new blob link if there is no link available', () => { + vm.mr.newBlobPath = null; + Vue.nextTick(() => { + expect(vm.$el.querySelector('a')).toEqual(null); + }); + }); }); }); |