fix(web): cap default images at 5 MiB
This commit is contained in:
@@ -28,7 +28,7 @@ const attachment = {
|
||||
|
||||
describe('attachment rejection copy', () => {
|
||||
const limits = {
|
||||
maxImageBytes: 10 * 1024 * 1024,
|
||||
maxImageBytes: 5 * 1024 * 1024,
|
||||
maxImagesPerMessage: 20,
|
||||
maxMessageImageBytes: 100 * 1024 * 1024,
|
||||
maxImagePixels: 40_000_000,
|
||||
@@ -47,7 +47,7 @@ describe('attachment rejection copy', () => {
|
||||
expect(attachmentErrorText(t, 'INVALID_IMAGE')).toBe('仅支持 PNG、JPG、WebP、GIF 格式的图片')
|
||||
expect(attachmentErrorText(t, 'IMAGE_TYPE_MISMATCH')).toBe('仅支持 PNG、JPG、WebP、GIF 格式的图片')
|
||||
expect(attachmentErrorText(t, 'TOO_MANY_IMAGES', limits)).toBe('一条消息最多添加 20 张图片')
|
||||
expect(attachmentErrorText(t, 'IMAGE_TOO_LARGE', limits)).toBe('单张图片不能超过 10MB')
|
||||
expect(attachmentErrorText(t, 'IMAGE_TOO_LARGE', limits)).toBe('单张图片不能超过 5MB')
|
||||
expect(attachmentErrorText(t, 'IMAGES_TOO_LARGE', limits)).toBe('图片总大小超过 100MB,请移除部分图片')
|
||||
expect(attachmentErrorText(enT, 'TOO_MANY_IMAGES', limits)).toBe('A message can include up to 20 images')
|
||||
})
|
||||
|
||||
@@ -323,7 +323,7 @@ describe('image draft rail', () => {
|
||||
const { view } = bench({
|
||||
addImages: vi.fn(() => null),
|
||||
imageLimits: {
|
||||
maxImageBytes: 10 * 1024 * 1024,
|
||||
maxImageBytes: 5 * 1024 * 1024,
|
||||
maxImagesPerMessage: 20,
|
||||
maxMessageImageBytes: 100 * 1024 * 1024,
|
||||
maxImagePixels: 40_000_000,
|
||||
@@ -331,7 +331,7 @@ describe('image draft rail', () => {
|
||||
},
|
||||
})
|
||||
fireEvent.dragEnter(document.body, { dataTransfer: { types: ['Files'], files: [], dropEffect: 'none' } })
|
||||
expect(view.getByRole('status').textContent).toContain('最多 20 张,每张 10MB')
|
||||
expect(view.getByRole('status').textContent).toContain('最多 20 张,每张 5MB')
|
||||
})
|
||||
|
||||
it('announces server attachment rejections as product copy, other codes as developer text', () => {
|
||||
|
||||
Reference in New Issue
Block a user