fix(ui): wrap items in gitignore dropdown (#8830)

- Resolves forgejo/forgejo#2639
- Simple E2E test to check that it doesn't overflow

Preview:
- https://codeberg.org/attachments/0466343b-7684-407b-bf97-311512bc5793
- https://codeberg.org/attachments/95626222-2f7c-4d56-9089-4fb4b7cac6ad

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8830
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-08-09 19:33:18 +02:00 committed by 0ko
commit 03d4073cdd
2 changed files with 22 additions and 1 deletions

View file

@ -7,7 +7,7 @@
<div class="hide-unless-checked"> <div class="hide-unless-checked">
<label> <label>
.gitignore .gitignore
<div class="ui multiple search selection dropdown"> <div class="ui multiple search selection dropdown tw-flex-wrap">
<input type="hidden" name="gitignores" value="{{.gitignores}}"> <input type="hidden" name="gitignores" value="{{.gitignores}}">
<div class="default text">{{ctx.Locale.Tr "repo.repo_gitignore_helper"}}</div> <div class="default text">{{ctx.Locale.Tr "repo.repo_gitignore_helper"}}</div>
<div class="menu"> <div class="menu">

View file

@ -125,3 +125,24 @@ test('New repo: label set', async ({page}) => {
await expect(page.getByText('Kind/Bug Something is not')).toBeVisible(); await expect(page.getByText('Kind/Bug Something is not')).toBeVisible();
await save_visual(page); await save_visual(page);
}); });
test('New repo: gitignore', async ({page}) => {
await page.goto('/repo/create');
await page.getByText('Start the Git history with').click();
const gitignoreDropdown = page.locator('.hide-unless-checked label:first-of-type > div');
await gitignoreDropdown.click();
await page.getByRole('option', {name: 'ArchLinuxPackages'}).click();
await page.getByRole('option', {name: 'Android'}).click();
await page.getByRole('option', {name: 'ChefCookbook'}).click();
await page.getByRole('option', {name: 'GNOMEShellExtension'}).click();
await page.getByRole('option', {name: 'JupyterNotebooks'}).click();
await page.getByRole('option', {name: 'NotesAndExtendedConfiguration'}).click();
await page.getByRole('option', {name: 'MetaProgrammingSystem'}).click();
await page.getByRole('option', {name: 'AppceleratorTitanium'}).click();
await save_visual(page);
const segmentWidth = (await page.locator('.segment').boundingBox()).width;
const dropdownWidth = (await gitignoreDropdown.boundingBox()).width;
expect(dropdownWidth).toBeLessThan(segmentWidth);
});