TF-4075 Change attachments location

(cherry picked from commit ab23dac45d9dcf7c5e057f8e16974b3ed8205771)
This commit is contained in:
dab246
2025-10-06 19:17:25 +07:00
committed by Dat H. Pham
parent 993b05fbc2
commit 6bbebd8e67
31 changed files with 540 additions and 486 deletions
@@ -83,6 +83,48 @@ void main() {
);
expect(result, attachments);
});
test('returns all if total width <= maxWidth', () {
final attachments = generateAttachments(5);
final result = EmailUtils.getAttachmentDisplayed(
maxWidth: 1400,
attachments: attachments,
isMobile: false,
);
expect(result.length, attachments.length);
});
test('returns some items when total width > maxWidth', () {
final attachments = generateAttachments(5);
final result = EmailUtils.getAttachmentDisplayed(
maxWidth: 600,
attachments: attachments,
isMobile: false,
);
expect(result.length, 1);
expect(result.first.name, 'A0');
});
test('returns 2 items if enough for 2 + button', () {
final attachments = generateAttachments(5);
final result = EmailUtils.getAttachmentDisplayed(
maxWidth: 800,
attachments: attachments,
isMobile: false,
);
expect(result.length, 2);
expect(result.map((e) => e.name), ['A0', 'A1']);
});
test('returns at least 1 even if not enough for one item + button', () {
final attachments = generateAttachments(5);
final result = EmailUtils.getAttachmentDisplayed(
maxWidth: 100,
attachments: attachments,
isMobile: false,
);
expect(result.length, 1);
});
});
});
}