Commit 47e875ea authored by Phil Hughes's avatar Phil Hughes

Added spec for rendering the selector

[ci skip]
parent 0820aab4
......@@ -149,7 +149,8 @@ export default {
<form-component
v-if="canUpdate && showForm"
:form-state="formState"
:can-destroy="canDestroy" />
:can-destroy="canDestroy"
:issuable-templates="issuableTemplates" />
<div v-else>
<title-component
:issuable-ref="issuableRef"
......
......@@ -16,16 +16,27 @@
components: {
descriptionTemplate,
},
computed: {
hasIssuableTemplates() {
return this.issuableTemplates.length !== 0;
},
},
};
</script>
<template>
<fieldset class="row">
<div class="col-sm-4 col-lg-3">
<div
class="col-sm-4 col-lg-3"
v-if="hasIssuableTemplates">
<description-template
:issuable-templates="issuableTemplates" />
</div>
<div class="col-sm-8 col-lg-9">
<div
:class="{
'col-sm-8 col-lg-9': hasIssuableTemplates,
'col-xs-12': !hasIssuableTemplates,
}">
<label
class="sr-only"
for="issue-title">
......
import Vue from 'vue';
import Store from '~/issue_show/stores';
import titleField from '~/issue_show/components/fields/title.vue';
import '~/templates/issuable_template_selectors';
describe('Title field component', () => {
let vm;
......@@ -27,4 +28,23 @@ describe('Title field component', () => {
vm.$el.querySelector('.form-control').value,
).toBe('test');
});
it('does not render template selector if no templates exist', () => {
expect(
vm.$el.querySelector('.js-issuable-selector-wrap'),
).toBeNull();
});
it('renders template selector when templates exists', (done) => {
spyOn(gl, 'IssuableTemplateSelectors');
vm.issuableTemplates = ['test'];
Vue.nextTick(() => {
expect(
vm.$el.querySelector('.js-issuable-selector-wrap'),
).not.toBeNull();
done();
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment