2017-05-16 11:18:52 -04:00
|
|
|
import Vue from 'vue';
|
|
|
|
import formComponent from '~/issue_show/components/form.vue';
|
|
|
|
|
|
|
|
describe('Inline edit form component', () => {
|
|
|
|
let vm;
|
|
|
|
|
|
|
|
beforeEach((done) => {
|
|
|
|
const Component = Vue.extend(formComponent);
|
|
|
|
|
|
|
|
vm = new Component({
|
|
|
|
propsData: {
|
|
|
|
canDestroy: true,
|
|
|
|
formState: {
|
|
|
|
title: 'b',
|
|
|
|
description: 'a',
|
2017-05-18 12:37:37 -04:00
|
|
|
lockedWarningVisible: false,
|
2017-05-16 11:18:52 -04:00
|
|
|
},
|
2017-08-17 13:25:56 -04:00
|
|
|
markdownPreviewPath: '/',
|
|
|
|
markdownDocsPath: '/',
|
2017-05-22 09:14:04 -04:00
|
|
|
projectPath: '/',
|
|
|
|
projectNamespace: '/',
|
2017-05-16 11:18:52 -04:00
|
|
|
},
|
|
|
|
}).$mount();
|
|
|
|
|
|
|
|
Vue.nextTick(done);
|
|
|
|
});
|
|
|
|
|
|
|
|
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) => {
|
|
|
|
vm.issuableTemplates = ['test'];
|
|
|
|
|
|
|
|
Vue.nextTick(() => {
|
|
|
|
expect(
|
|
|
|
vm.$el.querySelector('.js-issuable-selector-wrap'),
|
|
|
|
).not.toBeNull();
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2017-05-22 09:14:04 -04:00
|
|
|
|
2017-05-22 04:53:55 -04:00
|
|
|
it('hides locked warning by default', () => {
|
|
|
|
expect(
|
|
|
|
vm.$el.querySelector('.alert'),
|
|
|
|
).toBeNull();
|
|
|
|
});
|
|
|
|
|
2017-05-18 12:37:37 -04:00
|
|
|
it('shows locked warning if formState is different', (done) => {
|
|
|
|
vm.formState.lockedWarningVisible = true;
|
|
|
|
|
|
|
|
Vue.nextTick(() => {
|
|
|
|
expect(
|
|
|
|
vm.$el.querySelector('.alert'),
|
|
|
|
).not.toBeNull();
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2017-05-16 11:18:52 -04:00
|
|
|
});
|