@if (editingDescription) {
+
+
+
+
} @else {
@if (issue.description) {
diff --git a/src/app/issues/issue-detail/issue-detail.spec.ts b/src/app/issues/issue-detail/issue-detail.spec.ts
index fecb909..ada3755 100644
--- a/src/app/issues/issue-detail/issue-detail.spec.ts
+++ b/src/app/issues/issue-detail/issue-detail.spec.ts
@@ -519,6 +519,32 @@ describe('IssueDetail — existing issue', () => {
});
});
+ describe('description edit flow', () => {
+ it('startEditDescription sets editingDescription to true and stores original text', () => {
+ (component as any).issue.description = 'original';
+ (component as any).startEditDescription();
+ expect((component as any).editingDescription).toBe(true);
+ expect((component as any)._descriptionBeforeEdit).toBe('original');
+ });
+
+ it('saveDescription exits edit mode and persists the description', async () => {
+ (component as any).issue.description = 'updated';
+ (component as any).editingDescription = true;
+ await (component as any).saveDescription();
+ expect((component as any).editingDescription).toBe(false);
+ expect(store.getById(1)?.description).toBe('updated');
+ });
+
+ it('cancelEditDescription restores the original description and exits edit mode', () => {
+ (component as any).issue.description = 'original';
+ (component as any).startEditDescription();
+ (component as any).issue.description = 'changed mid-edit';
+ (component as any).cancelEditDescription();
+ expect((component as any).issue.description).toBe('original');
+ expect((component as any).editingDescription).toBe(false);
+ });
+ });
+
describe('onDescriptionPaste', () => {
afterEach(() => vi.unstubAllGlobals());
diff --git a/src/app/issues/issue-detail/issue-detail.ts b/src/app/issues/issue-detail/issue-detail.ts
index 5cb7f83..96e98c1 100644
--- a/src/app/issues/issue-detail/issue-detail.ts
+++ b/src/app/issues/issue-detail/issue-detail.ts
@@ -58,6 +58,7 @@ export class IssueDetail {
protected showAddDependency = false;
protected selectedCandidateId: number | null = null;
protected editingDescription = false;
+ private _descriptionBeforeEdit = '';
protected showAddToEpic = false;
protected selectedEpicCandidateId: number | null = null;
protected showCreateInEpic = false;
@@ -237,6 +238,21 @@ export class IssueDetail {
return !!this.issue.epic;
}
+ protected startEditDescription(): void {
+ this._descriptionBeforeEdit = this.issue.description;
+ this.editingDescription = true;
+ }
+
+ protected async saveDescription(): Promise {
+ this.editingDescription = false;
+ await this.saveIssue();
+ }
+
+ protected cancelEditDescription(): void {
+ this.issue.description = this._descriptionBeforeEdit;
+ this.editingDescription = false;
+ }
+
protected onDescriptionPaste(event: ClipboardEvent): void {
const ta = event.target as HTMLTextAreaElement;
const start = ta.selectionStart;