fix(codebase audit): preserve cleanup without regressions

Fix codebase audit regressions while preserving UI/UX behavior and adding review-driven hardening.
This commit is contained in:
Tommaso Casaburi
2026-04-24 15:48:07 +07:00
committed by GitHub
parent 5df994b2c7
commit 5dc5408a15
70 changed files with 1478 additions and 518 deletions
@@ -209,6 +209,8 @@ const clickButton = async (text: string) => {
});
};
const findButtonLink = (text: string) => Array.from(container.querySelectorAll<HTMLAnchorElement>('a.button')).find((candidate) => candidate.textContent === text);
const changeSelect = async (select: HTMLSelectElement, value: string) => {
await act(async () => {
select.value = value;
@@ -282,6 +284,7 @@ describe('BoardButtons', () => {
expect(container.querySelector('[data-testid="mod-queue-button"]')?.textContent).toBe('mu');
expect(container.textContent).toContain('subscribe');
expect(container.textContent).toContain('vote');
expect(findButtonLink('catalog')?.getAttribute('href')).toBe('/mu/catalog');
const searchInput = container.querySelector<HTMLInputElement>('input[type="text"]');
expect(searchInput).toBeTruthy();
@@ -317,6 +320,7 @@ describe('BoardButtons', () => {
expect(container.textContent).not.toContain('archive');
expect(container.querySelector('[data-testid="catalog-filters"]')?.textContent).toBe('catalog-filters');
expect(container.querySelector('[data-testid="catalog-search"]')?.textContent).toBe('catalog-search');
expect(findButtonLink('return')?.getAttribute('href')).toBe('/all?t=24h');
const selects = Array.from(container.querySelectorAll<HTMLSelectElement>('select'));
expect(selects).toHaveLength(5);
@@ -429,8 +433,7 @@ describe('BoardButtons', () => {
await renderWithRoute(createElement(MobileBoardButtons), '/mod/queue');
const returnLink = container.querySelector<HTMLAnchorElement>('a[href="/mod"]');
expect(returnLink?.getAttribute('href')).toBe('/mod');
expect(findButtonLink('return')?.getAttribute('href')).toBe('/mod');
const thresholdInput = container.querySelector<HTMLInputElement>('input[type="number"]');
const selects = Array.from(container.querySelectorAll<HTMLSelectElement>('select'));
@@ -6,7 +6,8 @@
margin-bottom: 7px;
}
.mobileBoardButtons button {
.mobileBoardButtons button,
.mobileBoardButtons a[class~='button'] {
text-transform: capitalize;
margin: 5px 2px;
}
@@ -33,7 +34,7 @@
cursor: not-allowed !important;
}
.mobileBoardButtons a, .desktopBoardButtons a {
.mobileBoardButtons a:not([class~='button']), .desktopBoardButtons a:not([class~='button']) {
all: unset;
}
@@ -147,4 +148,4 @@
.mobileBoardButtons {
display: none;
}
}
}
@@ -80,9 +80,9 @@ export const CatalogButton = ({ address, isInAllView, isInSubscriptionsView, isI
};
return (
<button className='button'>
<Link to={createCatalogLink()}>{t('catalog')}</Link>
</button>
<Link className='button' to={createCatalogLink()}>
{t('catalog')}
</Link>
);
};
@@ -151,9 +151,9 @@ export const ReturnButton = ({ address, isInAllView, isInSubscriptionsView, isIn
};
return (
<button className='button'>
<Link to={createReturnLink()}>{t('return')}</Link>
</button>
<Link className='button' to={createReturnLink()}>
{t('return')}
</Link>
);
};