mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-05 16:16:49 +00:00
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.
19 lines
780 B
TypeScript
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]);
|
|
});
|
|
});
|