mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-26 06:16:56 +09:00
Replace Fomantic's hard-forked jQuery modal with native `<dialog>` elements, advancing https://github.com/go-gitea/gitea/issues/29849. The UI is visually unchanged. Dialogs open with `show()` over an `inert` page, so tooltips, popups and toasts mounted on `<body>` stay usable above them, unlike with `showModal()` (https://github.com/whatwg/html/issues/9936). - Remove the Fomantic modal and dimmer, add `showModal` and `hideModal` - Declare modals as `<dialog class="modal-dialog">`, shown inside a `.modal-backdrop`, instead of `ui modal` with its unused size classes - Remove two modals that could never be opened - Block the page while a modal is open, close the topmost one on Escape and restore focus to its opener - Allow stacked modals, use a confirm modal instead of `window.confirm` for deleting content history - Hide popups and toasts when a modal opens or closes - Keep the release notes modal open when generating notes fails Fixes: https://github.com/go-gitea/gitea/issues/39643 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import {env} from 'node:process';
|
|
import {test, expect} from '@playwright/test';
|
|
import {login, apiCreateBranch, apiCreateRepo, randomString} from './utils.ts';
|
|
|
|
test('create a repository', async ({page}) => {
|
|
const repoName = `e2e-repo-${randomString(8)}`;
|
|
await login(page);
|
|
await page.goto('/repo/create');
|
|
await page.locator('input[name="repo_name"]').fill(repoName);
|
|
await page.getByRole('button', {name: 'Create Repository'}).click();
|
|
await page.waitForURL(new RegExp(`/${env.GITEA_TEST_E2E_USER}/${repoName}$`));
|
|
});
|
|
|
|
test('delete a branch via its modal', async ({page, request}) => {
|
|
const repoName = `e2e-branch-${randomString(8)}`;
|
|
const owner = env.GITEA_TEST_E2E_USER;
|
|
await Promise.all([
|
|
(async () => {
|
|
await apiCreateRepo(request, {name: repoName});
|
|
await apiCreateBranch(request, owner, repoName, 'feature');
|
|
})(),
|
|
login(page),
|
|
]);
|
|
await page.goto(`/${owner}/${repoName}/branches`);
|
|
await page.getByRole('button', {name: 'Delete Branch "feature"'}).click();
|
|
const modal = page.getByRole('dialog');
|
|
await expect(modal).toContainText('feature');
|
|
await modal.getByRole('button', {name: 'Yes'}).click();
|
|
await expect(page.locator('.flash-message')).toContainText('Branch "feature" has been deleted.');
|
|
});
|