2017-08-17 22:00:37 +05:30
|
|
|
import Vue from 'vue';
|
2018-05-09 12:01:36 +05:30
|
|
|
import UnresolvedDiscussions from '~/vue_merge_request_widget/components/states/unresolved_discussions.vue';
|
2018-10-15 14:42:47 +05:30
|
|
|
import mountComponent from 'spec/helpers/vue_mount_component_helper';
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
describe('UnresolvedDiscussions', () => {
|
2018-10-15 14:42:47 +05:30
|
|
|
const Component = Vue.extend(UnresolvedDiscussions);
|
|
|
|
let vm;
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
describe('with discussions path', () => {
|
2017-08-17 22:00:37 +05:30
|
|
|
beforeEach(() => {
|
2018-12-13 13:39:08 +05:30
|
|
|
vm = mountComponent(Component, {
|
|
|
|
mr: {
|
|
|
|
createIssueToResolveDiscussionsPath: gl.TEST_HOST,
|
|
|
|
},
|
|
|
|
});
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('should have correct elements', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(vm.$el.innerText).toContain(
|
|
|
|
'There are unresolved discussions. Please resolve these discussions',
|
|
|
|
);
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(vm.$el.innerText).toContain('Create an issue to resolve them later');
|
|
|
|
expect(vm.$el.querySelector('.js-create-issue').getAttribute('href')).toEqual(gl.TEST_HOST);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
2018-10-15 14:42:47 +05:30
|
|
|
});
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
describe('without discussions path', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Component, { mr: {} });
|
|
|
|
});
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
it('should not show create issue link if user cannot create issue', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(vm.$el.innerText).toContain(
|
|
|
|
'There are unresolved discussions. Please resolve these discussions',
|
|
|
|
);
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(vm.$el.querySelector('.js-create-issue')).toEqual(null);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|