mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5372] - fixed wrong result pipe (#6925)
* [ADF-5372] - fixed wrong result pipe * [ADF-5372] - fixed missing radix on parseInt
This commit is contained in:
@@ -44,6 +44,7 @@ describe('FileSizePipe', () => {
|
||||
it('returns empty string with invalid input', () => {
|
||||
expect(pipe.transform(null)).toBe('');
|
||||
expect(pipe.transform(undefined)).toBe('');
|
||||
expect(pipe.transform(NaN)).toBe('');
|
||||
});
|
||||
|
||||
it('should convert value to Bytes', () => {
|
||||
|
@@ -27,8 +27,13 @@ export class FileSizePipe implements PipeTransform {
|
||||
constructor(private translation: TranslationService) {
|
||||
}
|
||||
|
||||
transform(bytes: number, decimals: number = 2): string {
|
||||
if (bytes == null) {
|
||||
transform(paramByte: any, decimals: number = 2): string {
|
||||
if (paramByte == null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const bytes = parseInt(paramByte, 10);
|
||||
if (isNaN(bytes)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user