refactor: replace jquery.are-you-sure with first-party code (#39233)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind
2026-09-06 14:43:49 +08:00
committed by GitHub
co-authored by wxiaoguang
parent 3bd7ea4c9f
commit 7c280c0ce6
14 changed files with 180 additions and 265 deletions
+12
View File
@@ -24,3 +24,15 @@ test('comment on and close an issue', async ({page, request}) => {
await page.getByRole('button', {name: 'Close Issue'}).click();
await expect(page.getByRole('button', {name: 'Reopen Issue'})).toBeVisible();
});
test('unsaved issue description prompts before leaving', async ({page, request}) => {
const repoName = `e2e-are-you-sure-${randomString(8)}`;
await Promise.all([apiCreateRepo(request, {name: repoName, autoInit: false}), login(page)]);
await page.goto(`/${env.GITEA_TEST_E2E_USER}/${repoName}/issues/new`);
await page.getByPlaceholder('Leave a comment').press('a');
const dialogPromise = page.waitForEvent('dialog');
page.once('dialog', (dialog) => dialog.dismiss());
await page.getByRole('link', {name: 'Dashboard'}).click();
expect((await dialogPromise).type()).toBe('beforeunload');
await expect(page).toHaveURL(/\/issues\/new$/);
});