Commit 3c019fa1 authored by Maneschi Romain's avatar Maneschi Romain Committed by Mike Greiling

make test of note app with comments disabled dry

parent a8b48e24
---
title: make test of note app with comments disabled dry
merge_request: 32383
author: Romain Maneschi
type: other
...@@ -133,32 +133,31 @@ describe('note_app', () => { ...@@ -133,32 +133,31 @@ describe('note_app', () => {
); );
}); });
it('should not render form when commenting is disabled', () => { it('should render form comment button as disabled', () => {
wrapper.destroy(); expect(wrapper.find('.js-note-new-discussion').attributes('disabled')).toEqual('disabled');
});
store.state.commentsDisabled = true; it('updates discussions badge', () => {
wrapper = mountComponent(); expect(document.querySelector('.js-discussions-count').textContent).toEqual('2');
return waitForDiscussionsRequest().then(() => {
expect(wrapper.find('.js-main-target-form').exists()).toBe(false);
});
}); });
});
it('should render discussion filter note `commentsDisabled` is true', () => { describe('render with comments disabled', () => {
wrapper.destroy(); beforeEach(() => {
setFixtures('<div class="js-discussions-count"></div>');
Vue.http.interceptors.push(mockData.individualNoteInterceptor);
store.state.commentsDisabled = true; store.state.commentsDisabled = true;
wrapper = mountComponent(); wrapper = mountComponent();
return waitForDiscussionsRequest().then(() => { return waitForDiscussionsRequest();
expect(wrapper.find('.js-discussion-filter-note').exists()).toBe(true);
});
}); });
it('should render form comment button as disabled', () => { it('should not render form when commenting is disabled', () => {
expect(wrapper.find('.js-note-new-discussion').attributes('disabled')).toEqual('disabled'); expect(wrapper.find('.js-main-target-form').exists()).toBe(false);
}); });
it('updates discussions badge', () => { it('should render discussion filter note `commentsDisabled` is true', () => {
expect(document.querySelector('.js-discussions-count').textContent).toEqual('2'); expect(wrapper.find('.js-discussion-filter-note').exists()).toBe(true);
}); });
}); });
......
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