Files
webmail/lib/compose/__tests__/attachment-order.test.ts
T
Linus Rath d03d4a0b78 fix: show whole rows of attachments and keep uploading files in their place
The attachment order test now expects uploading files where they were
added: moved to the front, a big upload jumped out of sight once done.
2026-11-04 12:33:28 +01:00

19 lines
780 B
TypeScript

import { describe, expect, it } from 'vitest';
import { attachmentsForDisplay } from '../attachment-order';
describe('the order of the composer attachment chips', () => {
it('puts failed files first, and keeps the rest, uploading or not, in the order added', () => {
const files = [
{ name: 'a.pdf' },
{ name: 'b.pdf', uploading: true },
{ name: 'c.pdf' },
{ name: 'big.zip', uploading: true },
{ name: 'broken.png', error: 'failed' },
];
const shown = attachmentsForDisplay(files);
expect(shown.map(({ att }) => att.name)).toEqual(['broken.png', 'a.pdf', 'b.pdf', 'c.pdf', 'big.zip']);
// Each keeps its place in the composer's list, for Remove.
expect(shown.map(({ index }) => index)).toEqual([4, 0, 1, 2, 3]);
});
});