Commit 9212a0a9 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch 'psi-task-null-desc' into 'master'

Add proper null check for task item rendering

See merge request gitlab-org/gitlab!80781
parents cf91279d 8d268273
......@@ -95,7 +95,7 @@ export default {
this.renderGFM();
this.updateTaskStatusText();
if (this.workItemsEnabled && this.$el) {
if (this.workItemsEnabled) {
this.renderTaskActions();
}
},
......@@ -157,7 +157,12 @@ export default {
}
},
renderTaskActions() {
if (!this.$el?.querySelectorAll) {
return;
}
const taskListFields = this.$el.querySelectorAll('.task-list-item');
taskListFields.forEach((item, index) => {
const button = document.createElement('button');
button.classList.add(
......
......@@ -209,6 +209,27 @@ describe('Description component', () => {
});
describe('with work items feature flag is enabled', () => {
describe('empty description', () => {
beforeEach(async () => {
createComponent({
props: {
descriptionHtml: '',
},
provide: {
glFeatures: {
workItems: true,
},
},
});
await nextTick();
});
it('renders without error', () => {
expect(findTaskActionButtons()).toHaveLength(0);
});
});
describe('description with checkboxes', () => {
beforeEach(async () => {
createComponent({
props: {
......@@ -262,4 +283,5 @@ describe('Description component', () => {
expect(wrapper.text()).toContain(newTitle);
});
});
});
});
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