mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post-form): shorten long uploaded file labels in the form
Telegraph and other hosts can produce very long filenames that overflow the narrow post form upload row; truncate them more aggressively than post media links and expose the full name via title tooltip.
This commit is contained in:
@@ -643,6 +643,23 @@ describe('PostForm', () => {
|
||||
expect(table?.textContent).toContain('file name.jpg');
|
||||
});
|
||||
|
||||
it('shortens long pasted file-link filenames next to the upload button', async () => {
|
||||
testState.uploadedFileName = null;
|
||||
|
||||
await renderPostForm('/all');
|
||||
await clickByText(container, 'start_new_thread');
|
||||
|
||||
const table = container.querySelector('table');
|
||||
const textInputs = table?.querySelectorAll<HTMLInputElement>('input[type="text"]') || [];
|
||||
const linkInput = textInputs[2];
|
||||
const longFilename = 'TELEMMGLPICT000378070158_17159651831200_trans_NvBQzQNjv4BqpVlberWd9EgFPZtcLiMQf0Rf_Wk3V23H2268P_XkPxc.jpeg';
|
||||
|
||||
await dispatchInput(linkInput as HTMLInputElement, `https://www.telegraph.co.uk/multimedia/${longFilename}`);
|
||||
|
||||
expect(table?.textContent).toContain('TELEMMGLPICT...P_XkPxc.jpeg');
|
||||
expect(table?.textContent).not.toContain(longFilename);
|
||||
});
|
||||
|
||||
it('uses the shared loading ellipsis while a post form upload is running', async () => {
|
||||
testState.isUploading = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user