mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(rules): use hash links for directory deep links
Switch rules navigation from /rules/:code paths to /rules#code hashes, reject legacy subpaths, and ignore address hashes in markdown links.
This commit is contained in:
@@ -1389,7 +1389,20 @@ describe('PostForm', () => {
|
||||
expect(promptRow?.className).toBe('rules');
|
||||
expect(promptRow?.querySelector('ul')?.className).toBe('rules');
|
||||
expect(links.map((link) => link.textContent)).toEqual(['Rules', 'FAQ']);
|
||||
expect(links.map((link) => link.getAttribute('href'))).toEqual(['/rules/mu', '/faq']);
|
||||
expect(links.map((link) => link.getAttribute('href'))).toEqual(['/rules#mu', '/faq']);
|
||||
});
|
||||
|
||||
it('uses the plain rules page link for custom boards without a directory hash', async () => {
|
||||
testState.resolvedCommunityAddress = 'custom-board.bso';
|
||||
|
||||
await renderPostForm('/custom-board.bso');
|
||||
await clickByText(container, 'start_new_thread');
|
||||
|
||||
const promptRow = Array.from(container.querySelectorAll('tr')).find((row) => row.textContent === 'Please read the Rules and FAQ before posting.');
|
||||
const links = Array.from(promptRow?.querySelectorAll('a') || []);
|
||||
|
||||
expect(links.map((link) => link.textContent)).toEqual(['Rules', 'FAQ']);
|
||||
expect(links.map((link) => link.getAttribute('href'))).toEqual(['/rules', '/faq']);
|
||||
});
|
||||
|
||||
it('shortens long pasted file-link filenames next to the upload button', async () => {
|
||||
|
||||
Reference in New Issue
Block a user