mirror of
https://github.com/tutao/tutanota.git
synced 2025-10-19 07:53:47 +00:00
Fix browser tests for CalendarModel
Co-authored-by: and <and@tutao.de>
This commit is contained in:
parent
85504f63a7
commit
3bf8a06f2d
4 changed files with 13 additions and 5 deletions
|
@ -118,7 +118,7 @@ import {
|
|||
SyncStatus,
|
||||
} from "../../../common/calendar/gui/ImportExportUtils.js"
|
||||
import { UserError } from "../../../common/api/main/UserError.js"
|
||||
import { lang } from "../../../common/misc/LanguageViewModel.js"
|
||||
import { LanguageViewModel } from "../../../common/misc/LanguageViewModel.js"
|
||||
import { NativePushServiceApp } from "../../../common/native/main/NativePushServiceApp.js"
|
||||
import { SyncTracker } from "../../../common/api/main/SyncTracker.js"
|
||||
import { CacheMode } from "../../../common/api/worker/rest/EntityRestClient"
|
||||
|
@ -234,6 +234,7 @@ export class CalendarModel {
|
|||
private readonly pushService: NativePushServiceApp | null,
|
||||
private readonly syncTracker: SyncTracker,
|
||||
private readonly requestWidgetRefresh: () => void,
|
||||
private readonly lang: LanguageViewModel,
|
||||
) {
|
||||
this.readProgressMonitor = oneShotProgressMonitorGenerator(progressTracker, logins.getUserController())
|
||||
eventController.addEntityListener((updates, eventOwnerGroupId) => this.entityEventsReceived(updates, eventOwnerGroupId))
|
||||
|
@ -252,7 +253,7 @@ export class CalendarModel {
|
|||
private createBirthdayCalendarInfo(): BirthdayCalendarInfo {
|
||||
return {
|
||||
id: `${this.logins.getUserController().userId}#${BIRTHDAY_CALENDAR_BASE_ID}`,
|
||||
name: lang.get("birthdayCalendar_label"),
|
||||
name: this.lang.get("birthdayCalendar_label"),
|
||||
color: this.logins.getUserController().userSettingsGroupRoot.birthdayCalendarColor ?? DEFAULT_BIRTHDAY_CALENDAR_COLOR,
|
||||
type: CalendarType.Birthday,
|
||||
contactGroupId: getFirstOrThrow(this.logins.getUserController().getContactGroupMemberships()).group,
|
||||
|
@ -570,7 +571,7 @@ export class CalendarModel {
|
|||
}
|
||||
|
||||
if (skippedCalendars.size) {
|
||||
let errorMessage = lang.get("iCalSync_error") + (longErrorMessage ? "\n\n" : "")
|
||||
let errorMessage = this.lang.get("iCalSync_error") + (longErrorMessage ? "\n\n" : "")
|
||||
for (const [group, details] of skippedCalendars.entries()) {
|
||||
if (longErrorMessage) errorMessage += `${details.calendarName} - ${details.error.message}\n`
|
||||
this.deviceConfig.updateLastSync(group, SyncStatus.Failed)
|
||||
|
@ -1371,13 +1372,13 @@ export class CalendarModel {
|
|||
}
|
||||
|
||||
getBirthdayEventTitle(contactName: string) {
|
||||
return lang.get("birthdayEvent_title", {
|
||||
return this.lang.get("birthdayEvent_title", {
|
||||
"{name}": contactName,
|
||||
})
|
||||
}
|
||||
|
||||
getAgeString(age: number) {
|
||||
return lang.get("birthdayEventAge_title", { "{age}": age })
|
||||
return this.lang.get("birthdayEventAge_title", { "{age}": age })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ import { IdentityKeyCreator } from "../common/api/worker/facades/lazy/IdentityKe
|
|||
import { PublicIdentityKeyProvider } from "../common/api/worker/facades/PublicIdentityKeyProvider"
|
||||
import { WhitelabelThemeGenerator } from "../common/gui/WhitelabelThemeGenerator"
|
||||
import type { AutosaveFacade, LocalAutosavedDraftData } from "../common/api/worker/facades/lazy/AutosaveFacade"
|
||||
import { lang } from "../common/misc/LanguageViewModel.js"
|
||||
|
||||
assertMainOrNode()
|
||||
|
||||
|
@ -847,6 +848,7 @@ class CalendarLocator implements CommonLocator {
|
|||
() => {
|
||||
this.systemFacade.requestWidgetRefresh()
|
||||
},
|
||||
lang,
|
||||
)
|
||||
})
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ import { WhitelabelThemeGenerator } from "../common/gui/WhitelabelThemeGenerator
|
|||
import { UndoModel } from "./UndoModel"
|
||||
import { GroupSettingsModel } from "../common/sharing/model/GroupSettingsModel"
|
||||
import { AutosaveFacade } from "../common/api/worker/facades/lazy/AutosaveFacade"
|
||||
import { lang } from "../common/misc/LanguageViewModel.js"
|
||||
|
||||
assertMainOrNode()
|
||||
|
||||
|
@ -1051,6 +1052,7 @@ class MailLocator implements CommonLocator {
|
|||
!isBrowser() ? this.pushService : null,
|
||||
this.syncTracker,
|
||||
noOp,
|
||||
lang,
|
||||
)
|
||||
})
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ import { SyncTracker } from "../../../src/common/api/main/SyncTracker.js"
|
|||
import { ClientModelInfo } from "../../../src/common/api/common/EntityFunctions"
|
||||
import { EntityRestClient } from "../../../src/common/api/worker/rest/EntityRestClient"
|
||||
import { eventHasSameFields } from "../../../src/common/calendar/gui/ImportExportUtils"
|
||||
import { LanguageViewModel } from "../../../src/common/misc/LanguageViewModel.js"
|
||||
|
||||
o.spec("CalendarModel", function () {
|
||||
const noPatchesAndInstance: Pick<EntityUpdateData, "instance" | "patches"> = {
|
||||
|
@ -928,6 +929,7 @@ function init({
|
|||
syncTracker = makeSyncTracker(),
|
||||
}): CalendarModel {
|
||||
const lazyScheduler = async () => alarmScheduler
|
||||
const langMock: LanguageViewModel = object()
|
||||
|
||||
return new CalendarModel(
|
||||
notifications,
|
||||
|
@ -951,5 +953,6 @@ function init({
|
|||
}),
|
||||
syncTracker,
|
||||
() => {},
|
||||
langMock,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue