-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Docs(web-react): Add FileUploader demo #DS-896
- Loading branch information
1 parent
270abf3
commit ccf815b
Showing
4 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
packages/web-react/src/components/FileUploader/__tests__/utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { base64ToByteArray, image2Base64Preview } from '../utils'; | ||
|
||
const base64 = 'SGVsbG8gd29ybGQ='; | ||
const blob = new Uint8Array([72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]); | ||
|
||
describe('image2Base64Preview', () => { | ||
it('should convert image file to base64 string', () => { | ||
const file = new File([blob], 'image.jpg', { | ||
type: 'image/jpeg', | ||
}); | ||
|
||
image2Base64Preview(file, 100, (base64Preview) => { | ||
expect(base64Preview).toBeDefined(); | ||
expect(base64Preview).toBe(base64); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('base64ToByteArray', () => { | ||
it('should convert a base64 string to a byte array', () => { | ||
const result = base64ToByteArray(base64); | ||
|
||
expect(result).toEqual(blob); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/web-react/src/components/FileUploader/demo/FileUploaderAttachment.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/web-react/src/components/FileUploader/demo/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const DEMO_ATTACHMENT_BASE64_IMAGE = | ||
'/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCABkAGQDASIAAhEBAxEB/8QAHAAAAQUBAQEAAAAAAAAAAAAABQADBAYHAgEI/8QAORAAAgEDAwIEBAMGBQUAAAAAAQIDAAQRBRIhMUEGE1FhInGRoQcygRQjQnKxwRUWM9HwJENS4fH/xAAaAQACA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