mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-26 06:16:56 +09:00
chore: refactor legacy JS init code to use "data-global-init" (#39836)
Move the remaining legacy init code, which probed page classes with `querySelector`, to `data-global-init`, so each feature initializes from its own element. `hashchange` listeners now go through one module that runs them in priority order, because independent listeners broke when mount order changed. - Convert issue list, diff, repo create, settings and org team inits to `data-global-init` - Run `hashchange` listeners by priority, the diff scroll handler last - Make the devtest mock's failing log requests deterministic - Add e2e tests for diff tree navigation to folded files and job log permalinks --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
1 parent
ae17c14cff
commit
f690ea8efd
26 files changed
+122
-125
No files matched your search
@@ -27,3 +27,8 @@ test('job queue refreshes with filter open', async ({page, request}) => {
|
||||
await expect(page.getByRole('link', {name: 'queued #2'})).toBeVisible();
|
||||
await expect(waitingFilter).toBeVisible();
|
||||
});
|
||||
|
||||
test('job log line permalink expands its step', async ({page}) => {
|
||||
await page.goto('/devtest/repo-action-view/runs/10/jobs/1#jobstep-1-23');
|
||||
await expect(page.getByRole('link', {name: '23', exact: true})).toBeInViewport();
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
import {test, expect} from '@playwright/test';
|
||||
import {apiCreateFiles, apiCreatePR, apiCreateRepo, apiCreateUser, apiUserHeaders, loginUser, randomString} from './utils.ts';
|
||||
|
||||
test('diff sidebar filtering', async ({page, request}) => {
|
||||
test('diff sidebar filtering and folded file navigation', async ({page, request}) => {
|
||||
const user = `df-${randomString(8)}`;
|
||||
await apiCreateUser(request, user);
|
||||
const headers = apiUserHeaders(user);
|
||||
@@ -12,7 +12,7 @@ test('diff sidebar filtering', async ({page, request}) => {
|
||||
{path: 'src/a.ts', content: 'a\n'},
|
||||
{path: 'src/b.ts', content: 'b\n'},
|
||||
{path: 'src/.eslintrc', content: 'e\n'}, // dotfiles count as "No extension"
|
||||
{path: 'styles/x.css', content: 'x\n'},
|
||||
{path: 'styles/x.css', content: 'x\n'.repeat(150)},
|
||||
{path: 'docs/intro.md', content: 'r\n'},
|
||||
{path: 'Makefile', content: 'm\n'},
|
||||
], {branch: 'main', newBranch: 'feat', headers});
|
||||
@@ -34,6 +34,12 @@ test('diff sidebar filtering', async ({page, request}) => {
|
||||
const treeWidth = (await tree.boundingBox())!.width;
|
||||
expect(boxesWidth).toBeGreaterThan(treeWidth * 2);
|
||||
|
||||
await page.getByLabel('Diff Options').click();
|
||||
await page.getByRole('menuitem', {name: 'Collapse all files'}).click();
|
||||
await tree.getByRole('link', {name: 'x.css'}).click();
|
||||
const cssFileHeader = page.getByRole('link', {name: 'styles/x.css', exact: true});
|
||||
await expect.poll(async () => (await cssFileHeader.boundingBox())!.y).toBeLessThan(page.viewportSize()!.height / 2);
|
||||
|
||||
// search filters tree and file boxes
|
||||
await search.fill('a.ts');
|
||||
await expect(items).toHaveText([/a\.ts/]);
|
||||
|
||||
Reference in new issue
Block a user