diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2014-06-02 10:38:46 +0200 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2014-06-02 15:33:09 +0200 |
commit | 5d457dafc1d8a2aafb0d630a7f8a5b56cef7d97b (patch) | |
tree | f1bd503c4325abc493b70f10507bfea53186afa7 /core/js/tests/specs | |
parent | d39216c5e76b32c496ff39c19bddfbc4fa4247ac (diff) | |
download | nextcloud-server-5d457dafc1d8a2aafb0d630a7f8a5b56cef7d97b.tar.gz nextcloud-server-5d457dafc1d8a2aafb0d630a7f8a5b56cef7d97b.zip |
display "<1 kB" for really small files
* added parameters for humanFileSize to trigger that behaviour
* add unit tests for that
Diffstat (limited to 'core/js/tests/specs')
-rw-r--r-- | core/js/tests/specs/coreSpec.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index 65f768fbc51..6b85d8be166 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -489,6 +489,19 @@ describe('Core base tests', function() { expect(OC.Util.humanFileSize(data[i][0])).toEqual(data[i][1]); } }); + it('renders file sizes with the correct unit for small sizes', function() { + var data = [ + [0, '0 kB'], + [125, '< 1 kB'], + [128000, '125 kB'], + [128000000, '122.1 MB'], + [128000000000, '119.2 GB'], + [128000000000000, '116.4 TB'] + ]; + for (var i = 0; i < data.length; i++) { + expect(OC.Util.humanFileSize(data[i][0], true)).toEqual(data[i][1]); + } + }); }); }); }); |