mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
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:
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user