Skip to content

Commit 48a5e4d

Browse files
committed
fix(cypress): formatFileSize change revert from files library
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent b62515f commit 48a5e4d

14 files changed

Lines changed: 63 additions & 55 deletions

apps/files/src/components/FileEntry/FileEntryActions.vue

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,23 @@
4242
:open.sync="openedMenu"
4343
@close="openedSubmenu = null">
4444
<!-- Default actions list-->
45-
<template>
46-
<NcActionButton v-for="action in enabledMenuActions"
47-
:key="action.id"
48-
:class="{
49-
[`files-list__row-action-${action.id}`]: true,
50-
[`files-list__row-action--menu`]: isMenu(action.id)
51-
}"
52-
:close-after-click="!isMenu(action.id)"
53-
:data-cy-files-list-row-action="action.id"
54-
:is-menu="isMenu(action.id)"
55-
:title="action.title?.([source], currentView)"
56-
@click="onActionClick(action)">
57-
<template #icon>
58-
<NcLoadingIcon v-if="loading === action.id" :size="18" />
59-
<NcIconSvgWrapper v-else :svg="action.iconSvgInline([source], currentView)" />
60-
</template>
61-
{{ actionDisplayName(action) }}
62-
</NcActionButton>
63-
</template>
45+
<NcActionButton v-for="action in enabledMenuActions"
46+
:key="action.id"
47+
:class="{
48+
[`files-list__row-action-${action.id}`]: true,
49+
[`files-list__row-action--menu`]: isMenu(action.id)
50+
}"
51+
:close-after-click="!isMenu(action.id)"
52+
:data-cy-files-list-row-action="action.id"
53+
:is-menu="isMenu(action.id)"
54+
:title="action.title?.([source], currentView)"
55+
@click="onActionClick(action)">
56+
<template #icon>
57+
<NcLoadingIcon v-if="loading === action.id" :size="18" />
58+
<NcIconSvgWrapper v-else :svg="action.iconSvgInline([source], currentView)" />
59+
</template>
60+
{{ actionDisplayName(action) }}
61+
</NcActionButton>
6462

6563
<!-- Submenu actions list-->
6664
<template v-if="openedSubmenu && enabledSubmenuActions[openedSubmenu?.id]">

apps/files/src/components/NavigationQuota.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export default {
5151
5252
computed: {
5353
storageStatsTitle() {
54-
const usedQuotaByte = formatFileSize(this.storageStats?.used, false, false)
55-
const quotaByte = formatFileSize(this.storageStats?.quota, false, false)
54+
const usedQuotaByte = formatFileSize(this.storageStats?.used, false, false, true)
55+
const quotaByte = formatFileSize(this.storageStats?.quota, false, false, true)
5656
5757
// If no quota set
5858
if (this.storageStats?.quota < 0) {

apps/files/tests/js/filelistSpec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ describe('OCA.Files.FileList tests', function() {
539539
expect($summary.find('.fileinfo').text()).toEqual('2 files');
540540
expect($summary.find('.dirinfo').hasClass('hidden')).toEqual(false);
541541
expect($summary.find('.fileinfo').hasClass('hidden')).toEqual(false);
542-
expect($summary.find('.filesize').text()).toEqual('70 KB');
542+
expect($summary.find('.filesize').text()).toEqual('69 KB');
543543
expect(fileList.isEmpty).toEqual(false);
544544
});
545545
it('Shows empty content when removing last file', function() {
@@ -609,7 +609,7 @@ describe('OCA.Files.FileList tests', function() {
609609
expect($summary.find('.fileinfo').text()).toEqual('1 file');
610610
expect($summary.find('.dirinfo').hasClass('hidden')).toEqual(false);
611611
expect($summary.find('.fileinfo').hasClass('hidden')).toEqual(false);
612-
expect($summary.find('.filesize').text()).toEqual('58 KB');
612+
expect($summary.find('.filesize').text()).toEqual('57 KB');
613613
expect(fileList.isEmpty).toEqual(false);
614614
expect($('.files-filestable thead th').hasClass('hidden')).toEqual(false);
615615
expect($('.emptyfilelist.emptycontent').hasClass('hidden')).toEqual(true);
@@ -1138,7 +1138,7 @@ describe('OCA.Files.FileList tests', function() {
11381138
expect($summary.hasClass('hidden')).toEqual(false);
11391139
expect($summary.find('.dirinfo').text()).toEqual('1 folder');
11401140
expect($summary.find('.fileinfo').text()).toEqual('3 files');
1141-
expect($summary.find('.filesize').text()).toEqual('70 KB');
1141+
expect($summary.find('.filesize').text()).toEqual('69 KB');
11421142
});
11431143
it('shows headers, summary and hide empty content message after setting files', function(){
11441144
fileList.setFiles(testFiles);

apps/files/tests/js/filesummarySpec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('OCA.Files.FileSummary tests', function() {
4444
expect($container.hasClass('hidden')).toEqual(false);
4545
expect($container.find('.dirinfo').text()).toEqual('5 folders');
4646
expect($container.find('.fileinfo').text()).toEqual('2 files');
47-
expect($container.find('.filesize').text()).toEqual('256 KB');
47+
expect($container.find('.filesize').text()).toEqual('250 KB');
4848
});
4949
it('hides summary when no files or folders', function() {
5050
var s = new FileSummary($container);
@@ -68,7 +68,7 @@ describe('OCA.Files.FileSummary tests', function() {
6868
expect($container.hasClass('hidden')).toEqual(false);
6969
expect($container.find('.dirinfo').text()).toEqual('6 folders');
7070
expect($container.find('.fileinfo').text()).toEqual('3 files');
71-
expect($container.find('.filesize').text()).toEqual('512 KB');
71+
expect($container.find('.filesize').text()).toEqual('500 KB');
7272
expect(s.summary.totalDirs).toEqual(6);
7373
expect(s.summary.totalFiles).toEqual(3);
7474
expect(s.summary.totalSize).toEqual(512100);
@@ -86,7 +86,7 @@ describe('OCA.Files.FileSummary tests', function() {
8686
expect($container.hasClass('hidden')).toEqual(false);
8787
expect($container.find('.dirinfo').text()).toEqual('4 folders');
8888
expect($container.find('.fileinfo').text()).toEqual('1 file');
89-
expect($container.find('.filesize').text()).toEqual('128 KB');
89+
expect($container.find('.filesize').text()).toEqual('125 KB');
9090
expect(s.summary.totalDirs).toEqual(4);
9191
expect(s.summary.totalFiles).toEqual(1);
9292
expect(s.summary.totalSize).toEqual(127900);
@@ -104,7 +104,7 @@ describe('OCA.Files.FileSummary tests', function() {
104104
expect($container.find('.dirinfo').text()).toEqual('5 folders');
105105
expect($container.find('.fileinfo').text()).toEqual('2 files');
106106
expect($container.find('.filter').text()).toEqual(' match "foo"');
107-
expect($container.find('.filesize').text()).toEqual('256 KB');
107+
expect($container.find('.filesize').text()).toEqual('250 KB');
108108
});
109109
it('hides filtered summary when no files or folders', function() {
110110
var s = new FileSummary($container);
@@ -133,7 +133,7 @@ describe('OCA.Files.FileSummary tests', function() {
133133
expect($container.find('.dirinfo').text()).toEqual('6 folders');
134134
expect($container.find('.fileinfo').text()).toEqual('3 files');
135135
expect($container.find('.filter').text()).toEqual(' match "foo"');
136-
expect($container.find('.filesize').text()).toEqual('512 KB');
136+
expect($container.find('.filesize').text()).toEqual('500 KB');
137137
expect(s.summary.totalDirs).toEqual(6);
138138
expect(s.summary.totalFiles).toEqual(3);
139139
expect(s.summary.totalSize).toEqual(512103);
@@ -155,7 +155,7 @@ describe('OCA.Files.FileSummary tests', function() {
155155
expect($container.find('.dirinfo').text()).toEqual('4 folders');
156156
expect($container.find('.fileinfo').text()).toEqual('1 file');
157157
expect($container.find('.filter').text()).toEqual(' match "foo"');
158-
expect($container.find('.filesize').text()).toEqual('128 KB');
158+
expect($container.find('.filesize').text()).toEqual('125 KB');
159159
expect(s.summary.totalDirs).toEqual(4);
160160
expect(s.summary.totalFiles).toEqual(1);
161161
expect(s.summary.totalSize).toEqual(127903);
@@ -215,7 +215,7 @@ describe('OCA.Files.FileSummary tests', function() {
215215
expect($container.find('.fileinfo').text()).toEqual('1 file');
216216
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(false);
217217
expect($container.find('.hiddeninfo').text()).toEqual(' (including 1 hidden)');
218-
expect($container.find('.filesize').text()).toEqual('768 KB');
218+
expect($container.find('.filesize').text()).toEqual('750 KB');
219219
});
220220
it('does not render hidden count section when hidden files exist but are visible', function() {
221221
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: true });
@@ -228,7 +228,7 @@ describe('OCA.Files.FileSummary tests', function() {
228228
expect($container.find('.dirinfo').text()).toEqual('2 folders');
229229
expect($container.find('.fileinfo').text()).toEqual('1 file');
230230
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(true);
231-
expect($container.find('.filesize').text()).toEqual('768 KB');
231+
expect($container.find('.filesize').text()).toEqual('750 KB');
232232
});
233233
it('does not render hidden count section when no hidden files exist', function() {
234234
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: false });
@@ -240,7 +240,7 @@ describe('OCA.Files.FileSummary tests', function() {
240240
expect($container.find('.dirinfo').text()).toEqual('1 folder');
241241
expect($container.find('.fileinfo').text()).toEqual('1 file');
242242
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(true);
243-
expect($container.find('.filesize').text()).toEqual('256 KB');
243+
expect($container.find('.filesize').text()).toEqual('250 KB');
244244
});
245245
});
246246
});

apps/files/tests/js/mainfileinfodetailviewSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() {
6262
view.setFileInfo(testFileInfo);
6363
expect(view.$el.find('.fileName h3').text()).toEqual('One.txt');
6464
expect(view.$el.find('.fileName h3').attr('title')).toEqual('One.txt');
65-
expect(view.$el.find('.size').text()).toEqual('123.5 MB');
65+
expect(view.$el.find('.size').text()).toEqual('117.7 MB');
6666
expect(view.$el.find('.size').attr('title')).toEqual('123456789 bytes');
6767
expect(view.$el.find('.date').text()).toEqual('seconds ago');
6868
expect(view.$el.find('.date').attr('title')).toEqual(dateExpected);

apps/files_reminders/src/actions/setReminderSuggestionActions.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
*/
2222
// TODO: remove when/if the actions API supports a separator
2323
// This the last preset action, so we need to add a separator
24-
.files-list__row-action-set-reminder-3 {
25-
margin-bottom: 13px;
24+
.files-list__row-action-set-reminder-custom {
25+
margin-top: 13px;
26+
position: relative;
2627

27-
&::after {
28+
&::before {
2829
content: "";
2930
margin: 3px 10px 3px 15px;
3031
border-bottom: 1px solid var(--color-border-dark);
@@ -34,5 +35,6 @@
3435
position: absolute;
3536
left: 0;
3637
right: 0;
38+
top: -10px;
3739
}
3840
}

apps/files_reminders/src/actions/setReminderSuggestionActions.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,21 @@ const nextWeek: ReminderOption = {
6363
ariaLabel: t('files_reminders', 'Set reminder for next week'),
6464
}
6565

66-
// Generate the default preset actions
67-
export const actions = [laterToday, tomorrow, thisWeekend, nextWeek].map((option): FileAction|null => {
66+
/**
67+
* Generate a file action for the given option
68+
*
69+
* @param option The option to generate the action for
70+
* @return The file action or null if the option should not be shown
71+
*/
72+
const generateFileAction = (option): FileAction|null => {
6873
const dateTime = getDateTime(option.dateTimePreset)
6974
if (!dateTime) {
7075
return null
7176
}
7277

7378
return new FileAction({
7479
id: `set-reminder-${option.dateTimePreset}`,
75-
displayName: () => `${option.label} - ${getDateString(dateTime)}`,
80+
displayName: () => `${option.label} ${getDateString(dateTime)}`,
7681
title: () => `${option.ariaLabel}${getVerboseDateString(dateTime)}`,
7782

7883
// Empty svg to hide the icon
@@ -103,4 +108,9 @@ export const actions = [laterToday, tomorrow, thisWeekend, nextWeek].map((option
103108

104109
order: 21,
105110
})
106-
}).filter(Boolean) as FileAction[]
111+
}
112+
113+
// Generate the default preset actions
114+
export const actions = [laterToday, tomorrow, thisWeekend, nextWeek]
115+
.map(generateFileAction)
116+
.filter(Boolean) as FileAction[]

apps/files_reminders/src/components/SetCustomReminderModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ export default Vue.extend({
148148
},
149149
150150
async setCustom(): Promise<void> {
151-
// Handle input cleared
152-
if (this.customDueDate === '') {
151+
// Handle input cleared or invalid date
152+
if (!(this.customDueDate instanceof Date) || isNaN(this.customDueDate)) {
153153
showError(t('files_reminders', 'Please choose a valid date & time'))
154154
return
155155
}

apps/files_reminders/src/services/customPicker.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ const CustomReminderModal = new View({
3737
})
3838

3939
export const pickCustomDate = async (node: Node): Promise<void> => {
40-
console.debug('CustomReminderModal', mount, CustomReminderModal)
41-
4240
CustomReminderModal.open(node)
4341

4442
// Wait for the modal to close

apps/files_reminders/src/shared/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import moment from '@nextcloud/moment'
2424
import { getCanonicalLocale } from '@nextcloud/l10n'
2525

2626
export enum DateTimePreset {
27-
LaterToday,
28-
Tomorrow,
29-
ThisWeekend,
30-
NextWeek,
27+
LaterToday = 'later-today',
28+
Tomorrow = 'tomorrow',
29+
ThisWeekend = 'this-weekend',
30+
NextWeek = 'next-week',
3131
}
3232

3333
export const getDateTime = (dateTime: DateTimePreset): null | Date => {

0 commit comments

Comments
 (0)