summaryrefslogtreecommitdiffstats
path: root/tests/e2e
diff options
context:
space:
mode:
authorBeowulf <beowulf@beocode.eu>2025-01-17 18:22:43 +0100
committerBeowulf <beowulf@beocode.eu>2025-01-18 18:39:53 +0100
commit276ef10dd5a1167a8bcc20599197f89ff7f9b8a4 (patch)
treeb8809b67ed0a3e941b1ee91dc6acbd1e44d44925 /tests/e2e
parentUpdate renovate Docker tag to v39.115.4 (forgejo) (#6606) (diff)
downloadforgejo-276ef10dd5a1167a8bcc20599197f89ff7f9b8a4.tar.xz
forgejo-276ef10dd5a1167a8bcc20599197f89ff7f9b8a4.zip
Prevent prefix continuation if currently a text expander popup is open
This fixes that mentions and emoji autocompletion was broken in e.g. a list, because the list handling take presidency over the text expansion.
Diffstat (limited to 'tests/e2e')
-rw-r--r--tests/e2e/markdown-editor.test.e2e.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/e2e/markdown-editor.test.e2e.ts b/tests/e2e/markdown-editor.test.e2e.ts
index 762113d563..1e30b8d3b9 100644
--- a/tests/e2e/markdown-editor.test.e2e.ts
+++ b/tests/e2e/markdown-editor.test.e2e.ts
@@ -224,3 +224,29 @@ test('markdown insert table', async ({page}) => {
await expect(textarea).toHaveValue('| Header | Header |\n|---------|---------|\n| Content | Content |\n| Content | Content |\n| Content | Content |\n');
await save_visual(page);
});
+
+test('text expander has higher prio then prefix continuation', async ({page}) => {
+ const response = await page.goto('/user2/repo1/issues/new');
+ expect(response?.status()).toBe(200);
+
+ const textarea = page.locator('textarea[name=content]');
+ const initText = `* first`;
+ await textarea.fill(initText);
+ await textarea.evaluate((it:HTMLTextAreaElement) => it.setSelectionRange(it.value.indexOf('rst'), it.value.indexOf('rst')));
+ await textarea.press('End');
+
+ // Test emoji completion
+ await textarea.press('Enter');
+ await textarea.pressSequentially(':smile_c');
+ await textarea.press('Enter');
+ await expect(textarea).toHaveValue(`* first\n* 😸`);
+
+ // Test username completion
+ await textarea.press('Enter');
+ await textarea.pressSequentially('@user');
+ await textarea.press('Enter');
+ await expect(textarea).toHaveValue(`* first\n* 😸\n* @user2 `);
+
+ await textarea.press('Enter');
+ await expect(textarea).toHaveValue(`* first\n* 😸\n* @user2 \n* `);
+});