refactor: clean up legacy templates and js (#39808)

* Remove unused `"root"` data attributes from templates
* Use our "confirmModal" as much as possible (partially for #39643)
* Use "data-global-init" to refactor a lot of legacy code
* Refactor and clearify initRepoIssueCommentDelete's behavior to help #36862
* Remove dead code `common-organization.ts`
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-10-16 20:02:11 +08:00
1 parent a25d1d77eb
commit 2fe74d3cdd
17 files changed
+89 -101

No files matched your search

+6 -1
View File
@@ -117,8 +117,13 @@ test('pr review flow', async ({page, request}) => {
const pendingComment = fileBox.locator('.comment').filter({hasText: 'pending review comment'});
await expect(pendingComment.locator('[data-clipboard-text]')).toHaveAttribute('data-clipboard-text', /\/files#issuecomment-\d+$/);
await pendingComment.getByRole('menu').filter({has: page.getByRole('menuitem', {name: 'Delete', exact: true, includeHidden: true})}).click();
page.once('dialog', (dialog) => dialog.accept());
await pendingComment.getByRole('menuitem', {name: 'Delete', exact: true}).click();
await page.getByRole('button', {name: 'Cancel', exact: true}).click();
await expect(pendingComment).toBeVisible();
await expect(counter).toHaveAttribute('data-pending-comment-number', '1');
await pendingComment.getByRole('menu').filter({has: page.getByRole('menuitem', {name: 'Delete', exact: true, includeHidden: true})}).click();
await pendingComment.getByRole('menuitem', {name: 'Delete', exact: true}).click();
await page.getByRole('button', {name: 'Confirm', exact: true}).click();
await expect(pendingComment).toHaveCount(0);
await expect(counter).toHaveAttribute('data-pending-comment-number', '0');
await expect(counter).toHaveText('0');