diff options
author | Kushal Pandya <kushal@gitlab.com> | 2018-03-08 15:42:37 +0300 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2018-03-12 08:19:55 +0300 |
commit | 9d572c702a095b39473de3c286b8098563d8b30d (patch) | |
tree | f58bbdee00f7ef41b70a08cbe2ba3807c9ded2f6 /spec/javascripts/vue_shared/components/sidebar | |
parent | eeb957ec356d13269bb8fce3e125f7f750a2267b (diff) |
Add `headerTitle` prop for container header string
Diffstat (limited to 'spec/javascripts/vue_shared/components/sidebar')
-rw-r--r-- | spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js b/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js index f07aefb2f87..5cb4bb6fea6 100644 --- a/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js +++ b/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js @@ -6,10 +6,12 @@ import { mockSuggestedColors } from './mock_data'; import mountComponent from '../../../../helpers/vue_mount_component_helper'; -const createComponent = () => { +const createComponent = (headerTitle) => { const Component = Vue.extend(dropdownCreateLabelComponent); - return mountComponent(Component); + return mountComponent(Component, { + headerTitle, + }); }; describe('DropdownCreateLabelComponent', () => { @@ -41,11 +43,19 @@ describe('DropdownCreateLabelComponent', () => { expect(backButtonEl.querySelector('.fa-arrow-left')).not.toBe(null); }); - it('renders component header element', () => { + it('renders component header element as `Create new label` when `headerTitle` prop is not provided', () => { const headerEl = vm.$el.querySelector('.dropdown-title'); expect(headerEl.innerText.trim()).toContain('Create new label'); }); + it('renders component header element with value of `headerTitle` prop', () => { + const headerTitle = 'Create project label'; + const vmWithHeaderTitle = createComponent(headerTitle); + const headerEl = vmWithHeaderTitle.$el.querySelector('.dropdown-title'); + expect(headerEl.innerText.trim()).toContain(headerTitle); + vmWithHeaderTitle.$destroy(); + }); + it('renders `Close` button on component header', () => { const closeButtonEl = vm.$el.querySelector('.dropdown-title button.dropdown-title-button.dropdown-menu-close'); expect(closeButtonEl).not.toBe(null); |