diff options
author | Kushal Pandya <kushal@gitlab.com> | 2018-03-05 15:39:12 +0300 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2018-03-05 15:39:12 +0300 |
commit | b4bd9777fb519a537c011d87651d29683587893e (patch) | |
tree | dbefee73e6ff7b021e4982e4ff4359adaf86322e /spec/javascripts/vue_shared/components/sidebar | |
parent | 5989aa18f4ec49973e4d42015c1af8c93d3aed1f (diff) |
LabelsSelect DropdownHiddenInput Component
Diffstat (limited to 'spec/javascripts/vue_shared/components/sidebar')
-rw-r--r-- | spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_hidden_input_spec.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_hidden_input_spec.js b/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_hidden_input_spec.js new file mode 100644 index 00000000000..703b87498c7 --- /dev/null +++ b/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_hidden_input_spec.js @@ -0,0 +1,37 @@ +import Vue from 'vue'; + +import dropdownHiddenInputComponent from '~/vue_shared/components/sidebar/labels_select/dropdown_hidden_input.vue'; + +import { mockLabels } from './mock_data'; + +import mountComponent from '../../../../helpers/vue_mount_component_helper'; + +const createComponent = (name = 'label_id[]', label = mockLabels[0]) => { + const Component = Vue.extend(dropdownHiddenInputComponent); + + return mountComponent(Component, { + name, + label, + }); +}; + +describe('DropdownHiddenInputComponent', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('template', () => { + it('renders input element of type `hidden`', () => { + expect(vm.$el.nodeName).toBe('INPUT'); + expect(vm.$el.getAttribute('type')).toBe('hidden'); + expect(vm.$el.getAttribute('name')).toBe(vm.name); + expect(vm.$el.getAttribute('value')).toBe(`${vm.label.id}`); + }); + }); +}); |