loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ui): reset content of text field for comments when cancelling (#6595)

Currently, the content of the text field is not reset when you cancel editing. This change resets the content of the text field when editing is canceled.

If this is not done and you click on cancel and then on edit again, you can no longer return to the initial content without completely reloading the page.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6595
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Beowulf <beowulf@beocode.eu>
Co-committed-by: Beowulf <beowulf@beocode.eu>

authored by

Beowulf
Beowulf
and committed by
Gusted
34e1100a 376a2e19

+22
+21
tests/e2e/issue-comment.test.e2e.ts
··· 77 77 await save_visual(page); 78 78 }); 79 79 80 + test('Reset content of comment edit field on cancel', async ({page}) => { 81 + const response = await page.goto('/user2/repo1/issues/1'); 82 + expect(response?.status()).toBe(200); 83 + 84 + const editorTextarea = page.locator('[id="_combo_markdown_editor_1"]'); 85 + 86 + // Change the content of the edit field 87 + await page.click('#issue-1 .comment-container .context-menu'); 88 + await page.click('#issue-1 .comment-container .menu>.edit-content'); 89 + await expect(editorTextarea).toHaveValue('content for the first issue'); 90 + await editorTextarea.fill('some random string'); 91 + await expect(editorTextarea).toHaveValue('some random string'); 92 + await page.click('#issue-1 .comment-container .edit .cancel'); 93 + 94 + // Edit again and assert that the edit field should be reset to the initial content 95 + await page.click('#issue-1 .comment-container .context-menu'); 96 + await page.click('#issue-1 .comment-container .menu>.edit-content'); 97 + await expect(editorTextarea).toHaveValue('content for the first issue'); 98 + await save_visual(page); 99 + }); 100 + 80 101 test('Quote reply', async ({page}, workerInfo) => { 81 102 test.skip(workerInfo.project.name !== 'firefox', 'Uses Firefox specific selection quirks'); 82 103 const response = await page.goto('/user2/repo1/issues/1');
+1
web_src/js/features/repo-legacy.js
··· 405 405 e.preventDefault(); 406 406 showElem(renderContent); 407 407 hideElem(editContentZone); 408 + comboMarkdownEditor.value(rawContent.textContent); 408 409 comboMarkdownEditor.attachedDropzoneInst?.emit('reload'); 409 410 }; 410 411