diff options
author | Kushal Pandya <kushal@gitlab.com> | 2018-03-05 15:39:43 +0300 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2018-03-05 15:39:43 +0300 |
commit | 8b44ad6e6ab5408dca800b9cdb6a29335704109a (patch) | |
tree | e3118ea0cbe88901addb9017df9cecd78ec4fe0e /spec/javascripts/vue_shared/components/sidebar/labels_select | |
parent | 2e5497f0057021daa57d3e8958c840f6b8a82098 (diff) |
LabelsSelect DropdownTitle Component
Diffstat (limited to 'spec/javascripts/vue_shared/components/sidebar/labels_select')
-rw-r--r-- | spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_title_spec.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_title_spec.js b/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_title_spec.js new file mode 100644 index 00000000000..c3580933072 --- /dev/null +++ b/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_title_spec.js @@ -0,0 +1,42 @@ +import Vue from 'vue'; + +import dropdownTitleComponent from '~/vue_shared/components/sidebar/labels_select/dropdown_title.vue'; + +import mountComponent from '../../../../helpers/vue_mount_component_helper'; + +const createComponent = (canEdit = true) => { + const Component = Vue.extend(dropdownTitleComponent); + + return mountComponent(Component, { + canEdit, + }); +}; + +describe('DropdownTitleComponent', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('template', () => { + it('renders title text', () => { + expect(vm.$el.classList.contains('title', 'hide-collapsed')).toBe(true); + expect(vm.$el.innerText.trim()).toContain('Labels'); + }); + + it('renders spinner icon element', () => { + expect(vm.$el.querySelector('.fa-spinner.fa-spin.block-loading')).not.toBeNull(); + }); + + it('renders `Edit` button element', () => { + const editBtnEl = vm.$el.querySelector('button.edit-link.js-sidebar-dropdown-toggle'); + expect(editBtnEl).not.toBeNull(); + expect(editBtnEl.innerText.trim()).toBe('Edit'); + }); + }); +}); |