Files
gitea/tests/e2e/codeeditor.test.ts
T
12b5af068f fix(repo): use the viewed ref's editorconfig in file view, blame and editor (#39973) (#40019)
Backport #39973 by @Hello-Liar

The file view, blame and web editor read `.editorconfig` from the
default branch, so branch-specific settings like tab width were ignored.
The file view's middleware ran before the ref was resolved, and blame
never loaded it.

- `GetEditorconfig` reads the current commit, falling back to the
default branch only where no ref is resolved
- `Home` and `RefBlame` load the editorconfig after ref resolution

Fixes: https://github.com/go-gitea/gitea/issues/27413
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Hello-Liar <80651389+Hello-Liar@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-10-26 22:39:01 +00:00

20 lines
835 B
TypeScript

import {env} from 'node:process';
import {expect, test} from '@playwright/test';
import {login, apiCreateFiles, apiCreateRepo, randomString} from './utils.ts';
test('codeeditor textarea updates correctly', async ({page, request}) => {
const repoName = `e2e-codeeditor-${randomString(8)}`;
const owner = env.GITEA_TEST_E2E_USER;
await Promise.all([
(async () => {
await apiCreateRepo(request, {name: repoName});
await apiCreateFiles(request, owner, repoName, [{path: '.editorconfig', content: '[*]\nindent_size = 2\n'}], {newBranch: 'feature'});
})(),
login(page),
]);
await page.goto(`/${owner}/${repoName}/_new/feature`);
await page.locator('.cm-content[role="textbox"]').click();
await page.keyboard.press('Tab');
await expect(page.locator('textarea[name="content"]')).toHaveValue(' ');
});