mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-20 16:50:28 -05:00
[v10.0/forgejo] fix: Reset content of comment edit field on cancel (#6601)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/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. Co-authored-by: Beowulf <beowulf@beocode.eu> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6601 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Beowulf <beowulf@beocode.eu> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
2d1e163913
commit
6d0bf55f05
2 changed files with 22 additions and 0 deletions
|
@ -77,6 +77,27 @@ test('Always focus edit tab first on edit', async ({page}) => {
|
||||||
await save_visual(page);
|
await save_visual(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Reset content of comment edit field on cancel', async ({page}) => {
|
||||||
|
const response = await page.goto('/user2/repo1/issues/1');
|
||||||
|
expect(response?.status()).toBe(200);
|
||||||
|
|
||||||
|
const editorTextarea = page.locator('[id="_combo_markdown_editor_1"]');
|
||||||
|
|
||||||
|
// Change the content of the edit field
|
||||||
|
await page.click('#issue-1 .comment-container .context-menu');
|
||||||
|
await page.click('#issue-1 .comment-container .menu>.edit-content');
|
||||||
|
await expect(editorTextarea).toHaveValue('content for the first issue');
|
||||||
|
await editorTextarea.fill('some random string');
|
||||||
|
await expect(editorTextarea).toHaveValue('some random string');
|
||||||
|
await page.click('#issue-1 .comment-container .edit .cancel');
|
||||||
|
|
||||||
|
// Edit again and assert that the edit field should be reset to the initial content
|
||||||
|
await page.click('#issue-1 .comment-container .context-menu');
|
||||||
|
await page.click('#issue-1 .comment-container .menu>.edit-content');
|
||||||
|
await expect(editorTextarea).toHaveValue('content for the first issue');
|
||||||
|
await save_visual(page);
|
||||||
|
});
|
||||||
|
|
||||||
test('Quote reply', async ({page}, workerInfo) => {
|
test('Quote reply', async ({page}, workerInfo) => {
|
||||||
test.skip(workerInfo.project.name !== 'firefox', 'Uses Firefox specific selection quirks');
|
test.skip(workerInfo.project.name !== 'firefox', 'Uses Firefox specific selection quirks');
|
||||||
const response = await page.goto('/user2/repo1/issues/1');
|
const response = await page.goto('/user2/repo1/issues/1');
|
||||||
|
|
|
@ -404,6 +404,7 @@ async function onEditContent(event) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
showElem(renderContent);
|
showElem(renderContent);
|
||||||
hideElem(editContentZone);
|
hideElem(editContentZone);
|
||||||
|
comboMarkdownEditor.value(rawContent.textContent);
|
||||||
comboMarkdownEditor.attachedDropzoneInst?.emit('reload');
|
comboMarkdownEditor.attachedDropzoneInst?.emit('reload');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue