make test of note app with comments disabled dry
This commit is contained in:
parent
a8b48e240a
commit
3c019fa1d4
2 changed files with 24 additions and 20 deletions
5
changelogs/unreleased/62673-clean-note-app-tests.yml
Normal file
5
changelogs/unreleased/62673-clean-note-app-tests.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: make test of note app with comments disabled dry
|
||||||
|
merge_request: 32383
|
||||||
|
author: Romain Maneschi
|
||||||
|
type: other
|
|
@ -133,26 +133,6 @@ describe('note_app', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not render form when commenting is disabled', () => {
|
|
||||||
wrapper.destroy();
|
|
||||||
|
|
||||||
store.state.commentsDisabled = true;
|
|
||||||
wrapper = mountComponent();
|
|
||||||
return waitForDiscussionsRequest().then(() => {
|
|
||||||
expect(wrapper.find('.js-main-target-form').exists()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render discussion filter note `commentsDisabled` is true', () => {
|
|
||||||
wrapper.destroy();
|
|
||||||
|
|
||||||
store.state.commentsDisabled = true;
|
|
||||||
wrapper = mountComponent();
|
|
||||||
return waitForDiscussionsRequest().then(() => {
|
|
||||||
expect(wrapper.find('.js-discussion-filter-note').exists()).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render form comment button as disabled', () => {
|
it('should render form comment button as disabled', () => {
|
||||||
expect(wrapper.find('.js-note-new-discussion').attributes('disabled')).toEqual('disabled');
|
expect(wrapper.find('.js-note-new-discussion').attributes('disabled')).toEqual('disabled');
|
||||||
});
|
});
|
||||||
|
@ -162,6 +142,25 @@ describe('note_app', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('render with comments disabled', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
setFixtures('<div class="js-discussions-count"></div>');
|
||||||
|
|
||||||
|
Vue.http.interceptors.push(mockData.individualNoteInterceptor);
|
||||||
|
store.state.commentsDisabled = true;
|
||||||
|
wrapper = mountComponent();
|
||||||
|
return waitForDiscussionsRequest();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not render form when commenting is disabled', () => {
|
||||||
|
expect(wrapper.find('.js-main-target-form').exists()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render discussion filter note `commentsDisabled` is true', () => {
|
||||||
|
expect(wrapper.find('.js-discussion-filter-note').exists()).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('while fetching data', () => {
|
describe('while fetching data', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
Vue.http.interceptors.push(emptyResponseInterceptor);
|
Vue.http.interceptors.push(emptyResponseInterceptor);
|
||||||
|
|
Loading…
Reference in a new issue