diff --git a/CHANGELOG.md b/CHANGELOG.md index ce90e6cd..012307d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ _This release is scheduled to be released on 2023-04-01._ ### Fixed - Fix wrong day labels in envcanada forecast (#2987) +- Fix for missing default class name prefix for customEvents in calendar - Fix weathergov provider hourly forecast (#3008) ## [2.22.0] - 2023-01-01 diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 8700fbd2..15da1d5d 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -665,7 +665,9 @@ Module.register("calendar", { if (typeof ev.symbol !== "undefined" && ev.symbol !== "") { let needle = new RegExp(ev.keyword, "gi"); if (needle.test(event.title)) { - symbols[0] = ev.symbol; + // Get the default prefix for this class name and add to the custom symbol provided + const className = this.getCalendarProperty(event.url, "symbolClassName", this.config.defaultSymbolClassName); + symbols[0] = className + ev.symbol; break; } } diff --git a/tests/configs/modules/calendar/custom.js b/tests/configs/modules/calendar/custom.js index 54d117d7..993ac483 100644 --- a/tests/configs/modules/calendar/custom.js +++ b/tests/configs/modules/calendar/custom.js @@ -11,9 +11,10 @@ let config = { module: "calendar", position: "bottom_bar", config: { + customEvents: [{ keyword: "CustomEvent", symbol: "dice" }], calendars: [ { - maximumEntries: 4, + maximumEntries: 5, maximumNumberOfDays: 10000, symbol: "birthday-cake", fullDaySymbol: "calendar-day", diff --git a/tests/e2e/modules/calendar_spec.js b/tests/e2e/modules/calendar_spec.js index e1bee78e..6218bfb3 100644 --- a/tests/e2e/modules/calendar_spec.js +++ b/tests/e2e/modules/calendar_spec.js @@ -48,14 +48,18 @@ describe("Calendar module", () => { await helpers.getDocument(); }); - it("should show the custom maximumEntries of 4", async () => { - await testElementLength(".calendar .event", 4); + it("should show the custom maximumEntries of 5", async () => { + await testElementLength(".calendar .event", 5); }); - it("should show the custom calendar symbol in each event", async () => { + it("should show the custom calendar symbol in four events", async () => { await testElementLength(".calendar .event .fa-birthday-cake", 4); }); + it("should show a customEvent calendar symbol in one event", async () => { + await testElementLength(".calendar .event .fa-dice", 1); + }); + it("should show two custom icons for repeating events", async () => { await testElementLength(".calendar .event .fa-undo", 2); }); diff --git a/tests/mocks/calendar_test_icons.ics b/tests/mocks/calendar_test_icons.ics index 7f24060d..41e64dea 100644 --- a/tests/mocks/calendar_test_icons.ics +++ b/tests/mocks/calendar_test_icons.ics @@ -53,4 +53,11 @@ RRULE:FREQ=YEARLY;BYMONTH=10;BYMONTHDAY=1 DTEND;VALUE=DATE:20301002 SUMMARY:TestEventRepeatDay END:VEVENT -END:VCALENDAR \ No newline at end of file +BEGIN:VEVENT +DTSTAMP:20200721T094531Z +UID:20200719T094531Z-167389794@marudot.com +DTSTART;TZID=Europe/Berlin:20301112T120000 +DTEND;TZID=Europe/Berlin:20301112T130000 +SUMMARY:TestEventCustomEventIcon +END:VEVENT +END:VCALENDAR