aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-11-03 19:49:53 +0100
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-11-08 08:40:27 +0100
commit32c1aebaae07b9b4d7e2dcdfca6b2cbd36a6cfc3 (patch)
tree26b047d37a3c3276e9336936f0d5c8bbde949869 /apps/files
parent50417bcee8f103fb569a860b63cf8cf1e6bc1c18 (diff)
downloadnextcloud-server-32c1aebaae07b9b4d7e2dcdfca6b2cbd36a6cfc3.tar.gz
nextcloud-server-32c1aebaae07b9b4d7e2dcdfca6b2cbd36a6cfc3.zip
fix(cypress): formatFileSize change revert from files library
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/src/components/FileEntry/FileEntryActions.vue36
-rw-r--r--apps/files/src/components/NavigationQuota.vue4
-rw-r--r--apps/files/tests/js/filelistSpec.js6
-rw-r--r--apps/files/tests/js/filesummarySpec.js18
-rw-r--r--apps/files/tests/js/mainfileinfodetailviewSpec.js2
5 files changed, 32 insertions, 34 deletions
diff --git a/apps/files/src/components/FileEntry/FileEntryActions.vue b/apps/files/src/components/FileEntry/FileEntryActions.vue
index 3637c9472d5..5a1b3235d90 100644
--- a/apps/files/src/components/FileEntry/FileEntryActions.vue
+++ b/apps/files/src/components/FileEntry/FileEntryActions.vue
@@ -42,25 +42,23 @@
:open.sync="openedMenu"
@close="openedSubmenu = null">
<!-- Default actions list-->
- <template>
- <NcActionButton v-for="action in enabledMenuActions"
- :key="action.id"
- :class="{
- [`files-list__row-action-${action.id}`]: true,
- [`files-list__row-action--menu`]: isMenu(action.id)
- }"
- :close-after-click="!isMenu(action.id)"
- :data-cy-files-list-row-action="action.id"
- :is-menu="isMenu(action.id)"
- :title="action.title?.([source], currentView)"
- @click="onActionClick(action)">
- <template #icon>
- <NcLoadingIcon v-if="loading === action.id" :size="18" />
- <NcIconSvgWrapper v-else :svg="action.iconSvgInline([source], currentView)" />
- </template>
- {{ actionDisplayName(action) }}
- </NcActionButton>
- </template>
+ <NcActionButton v-for="action in enabledMenuActions"
+ :key="action.id"
+ :class="{
+ [`files-list__row-action-${action.id}`]: true,
+ [`files-list__row-action--menu`]: isMenu(action.id)
+ }"
+ :close-after-click="!isMenu(action.id)"
+ :data-cy-files-list-row-action="action.id"
+ :is-menu="isMenu(action.id)"
+ :title="action.title?.([source], currentView)"
+ @click="onActionClick(action)">
+ <template #icon>
+ <NcLoadingIcon v-if="loading === action.id" :size="18" />
+ <NcIconSvgWrapper v-else :svg="action.iconSvgInline([source], currentView)" />
+ </template>
+ {{ actionDisplayName(action) }}
+ </NcActionButton>
<!-- Submenu actions list-->
<template v-if="openedSubmenu && enabledSubmenuActions[openedSubmenu?.id]">
diff --git a/apps/files/src/components/NavigationQuota.vue b/apps/files/src/components/NavigationQuota.vue
index 25bdcde1b45..18cd99f248b 100644
--- a/apps/files/src/components/NavigationQuota.vue
+++ b/apps/files/src/components/NavigationQuota.vue
@@ -51,8 +51,8 @@ export default {
computed: {
storageStatsTitle() {
- const usedQuotaByte = formatFileSize(this.storageStats?.used, false, false)
- const quotaByte = formatFileSize(this.storageStats?.quota, false, false)
+ const usedQuotaByte = formatFileSize(this.storageStats?.used, false, false, true)
+ const quotaByte = formatFileSize(this.storageStats?.quota, false, false, true)
// If no quota set
if (this.storageStats?.quota < 0) {
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index f2caa176973..cd3510c2faa 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -539,7 +539,7 @@ describe('OCA.Files.FileList tests', function() {
expect($summary.find('.fileinfo').text()).toEqual('2 files');
expect($summary.find('.dirinfo').hasClass('hidden')).toEqual(false);
expect($summary.find('.fileinfo').hasClass('hidden')).toEqual(false);
- expect($summary.find('.filesize').text()).toEqual('70 KB');
+ expect($summary.find('.filesize').text()).toEqual('69 KB');
expect(fileList.isEmpty).toEqual(false);
});
it('Shows empty content when removing last file', function() {
@@ -609,7 +609,7 @@ describe('OCA.Files.FileList tests', function() {
expect($summary.find('.fileinfo').text()).toEqual('1 file');
expect($summary.find('.dirinfo').hasClass('hidden')).toEqual(false);
expect($summary.find('.fileinfo').hasClass('hidden')).toEqual(false);
- expect($summary.find('.filesize').text()).toEqual('58 KB');
+ expect($summary.find('.filesize').text()).toEqual('57 KB');
expect(fileList.isEmpty).toEqual(false);
expect($('.files-filestable thead th').hasClass('hidden')).toEqual(false);
expect($('.emptyfilelist.emptycontent').hasClass('hidden')).toEqual(true);
@@ -1138,7 +1138,7 @@ describe('OCA.Files.FileList tests', function() {
expect($summary.hasClass('hidden')).toEqual(false);
expect($summary.find('.dirinfo').text()).toEqual('1 folder');
expect($summary.find('.fileinfo').text()).toEqual('3 files');
- expect($summary.find('.filesize').text()).toEqual('70 KB');
+ expect($summary.find('.filesize').text()).toEqual('69 KB');
});
it('shows headers, summary and hide empty content message after setting files', function(){
fileList.setFiles(testFiles);
diff --git a/apps/files/tests/js/filesummarySpec.js b/apps/files/tests/js/filesummarySpec.js
index 22c95abd307..8bc7bd8f995 100644
--- a/apps/files/tests/js/filesummarySpec.js
+++ b/apps/files/tests/js/filesummarySpec.js
@@ -44,7 +44,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('5 folders');
expect($container.find('.fileinfo').text()).toEqual('2 files');
- expect($container.find('.filesize').text()).toEqual('256 KB');
+ expect($container.find('.filesize').text()).toEqual('250 KB');
});
it('hides summary when no files or folders', function() {
var s = new FileSummary($container);
@@ -68,7 +68,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('6 folders');
expect($container.find('.fileinfo').text()).toEqual('3 files');
- expect($container.find('.filesize').text()).toEqual('512 KB');
+ expect($container.find('.filesize').text()).toEqual('500 KB');
expect(s.summary.totalDirs).toEqual(6);
expect(s.summary.totalFiles).toEqual(3);
expect(s.summary.totalSize).toEqual(512100);
@@ -86,7 +86,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('4 folders');
expect($container.find('.fileinfo').text()).toEqual('1 file');
- expect($container.find('.filesize').text()).toEqual('128 KB');
+ expect($container.find('.filesize').text()).toEqual('125 KB');
expect(s.summary.totalDirs).toEqual(4);
expect(s.summary.totalFiles).toEqual(1);
expect(s.summary.totalSize).toEqual(127900);
@@ -104,7 +104,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.dirinfo').text()).toEqual('5 folders');
expect($container.find('.fileinfo').text()).toEqual('2 files');
expect($container.find('.filter').text()).toEqual(' match "foo"');
- expect($container.find('.filesize').text()).toEqual('256 KB');
+ expect($container.find('.filesize').text()).toEqual('250 KB');
});
it('hides filtered summary when no files or folders', function() {
var s = new FileSummary($container);
@@ -133,7 +133,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.dirinfo').text()).toEqual('6 folders');
expect($container.find('.fileinfo').text()).toEqual('3 files');
expect($container.find('.filter').text()).toEqual(' match "foo"');
- expect($container.find('.filesize').text()).toEqual('512 KB');
+ expect($container.find('.filesize').text()).toEqual('500 KB');
expect(s.summary.totalDirs).toEqual(6);
expect(s.summary.totalFiles).toEqual(3);
expect(s.summary.totalSize).toEqual(512103);
@@ -155,7 +155,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.dirinfo').text()).toEqual('4 folders');
expect($container.find('.fileinfo').text()).toEqual('1 file');
expect($container.find('.filter').text()).toEqual(' match "foo"');
- expect($container.find('.filesize').text()).toEqual('128 KB');
+ expect($container.find('.filesize').text()).toEqual('125 KB');
expect(s.summary.totalDirs).toEqual(4);
expect(s.summary.totalFiles).toEqual(1);
expect(s.summary.totalSize).toEqual(127903);
@@ -215,7 +215,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.fileinfo').text()).toEqual('1 file');
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(false);
expect($container.find('.hiddeninfo').text()).toEqual(' (including 1 hidden)');
- expect($container.find('.filesize').text()).toEqual('768 KB');
+ expect($container.find('.filesize').text()).toEqual('750 KB');
});
it('does not render hidden count section when hidden files exist but are visible', function() {
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: true });
@@ -228,7 +228,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.dirinfo').text()).toEqual('2 folders');
expect($container.find('.fileinfo').text()).toEqual('1 file');
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(true);
- expect($container.find('.filesize').text()).toEqual('768 KB');
+ expect($container.find('.filesize').text()).toEqual('750 KB');
});
it('does not render hidden count section when no hidden files exist', function() {
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: false });
@@ -240,7 +240,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.dirinfo').text()).toEqual('1 folder');
expect($container.find('.fileinfo').text()).toEqual('1 file');
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(true);
- expect($container.find('.filesize').text()).toEqual('256 KB');
+ expect($container.find('.filesize').text()).toEqual('250 KB');
});
});
});
diff --git a/apps/files/tests/js/mainfileinfodetailviewSpec.js b/apps/files/tests/js/mainfileinfodetailviewSpec.js
index b63c36199a6..5793db8fb98 100644
--- a/apps/files/tests/js/mainfileinfodetailviewSpec.js
+++ b/apps/files/tests/js/mainfileinfodetailviewSpec.js
@@ -62,7 +62,7 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() {
view.setFileInfo(testFileInfo);
expect(view.$el.find('.fileName h3').text()).toEqual('One.txt');
expect(view.$el.find('.fileName h3').attr('title')).toEqual('One.txt');
- expect(view.$el.find('.size').text()).toEqual('123.5 MB');
+ expect(view.$el.find('.size').text()).toEqual('117.7 MB');
expect(view.$el.find('.size').attr('title')).toEqual('123456789 bytes');
expect(view.$el.find('.date').text()).toEqual('seconds ago');
expect(view.$el.find('.date').attr('title')).toEqual(dateExpected);