diff options
Diffstat (limited to 'spec/frontend/issuable_show/components/issuable_description_spec.js')
-rw-r--r-- | spec/frontend/issuable_show/components/issuable_description_spec.js | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/spec/frontend/issuable_show/components/issuable_description_spec.js b/spec/frontend/issuable_show/components/issuable_description_spec.js index 29ecce1002d..1058e5decfd 100644 --- a/spec/frontend/issuable_show/components/issuable_description_spec.js +++ b/spec/frontend/issuable_show/components/issuable_description_spec.js @@ -5,9 +5,14 @@ import IssuableDescription from '~/issuable_show/components/issuable_description import { mockIssuable } from '../mock_data'; -const createComponent = (issuable = mockIssuable) => +const createComponent = ({ + issuable = mockIssuable, + enableTaskList = true, + canEdit = true, + taskListUpdatePath = `${mockIssuable.webUrl}.json`, +} = {}) => shallowMount(IssuableDescription, { - propsData: { issuable }, + propsData: { issuable, enableTaskList, canEdit, taskListUpdatePath }, }); describe('IssuableDescription', () => { @@ -38,4 +43,27 @@ describe('IssuableDescription', () => { }); }); }); + + describe('templates', () => { + it('renders container element with class `js-task-list-container` when canEdit and enableTaskList props are true', () => { + expect(wrapper.classes()).toContain('js-task-list-container'); + }); + + it('renders container element without class `js-task-list-container` when canEdit and enableTaskList props are true', () => { + const wrapperNoTaskList = createComponent({ + enableTaskList: false, + }); + + expect(wrapperNoTaskList.classes()).not.toContain('js-task-list-container'); + + wrapperNoTaskList.destroy(); + }); + + it('renders hidden textarea element when issuable.description is present and enableTaskList prop is true', () => { + const textareaEl = wrapper.find('textarea.gl-display-none.js-task-list-field'); + + expect(textareaEl.exists()).toBe(true); + expect(textareaEl.attributes('data-update-url')).toBe(`${mockIssuable.webUrl}.json`); + }); + }); }); |