mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Add test for changing the calendar symbol
This commit is contained in:
parent
73aa35ea2c
commit
8b1d1671f7
@ -13,8 +13,6 @@ Module.register("calendar", {
|
|||||||
maximumNumberOfDays: 365,
|
maximumNumberOfDays: 365,
|
||||||
displaySymbol: true,
|
displaySymbol: true,
|
||||||
defaultSymbol: "calendar", // Fontawesome Symbol see https://fontawesome.com/cheatsheet?from=io
|
defaultSymbol: "calendar", // Fontawesome Symbol see https://fontawesome.com/cheatsheet?from=io
|
||||||
fullDaySymbol: "calendar", // Fontawesome Symbol
|
|
||||||
recurringSymbol: "calendar", // Fontawesome Symbol
|
|
||||||
showLocation: false,
|
showLocation: false,
|
||||||
displayRepeatingCountTitle: false,
|
displayRepeatingCountTitle: false,
|
||||||
defaultRepeatingCountTitle: "",
|
defaultRepeatingCountTitle: "",
|
||||||
@ -568,12 +566,12 @@ Module.register("calendar", {
|
|||||||
symbolsForEvent: function (event) {
|
symbolsForEvent: function (event) {
|
||||||
let symbols = this.getCalendarPropertyAsArray(event.url, "symbol", this.config.defaultSymbol);
|
let symbols = this.getCalendarPropertyAsArray(event.url, "symbol", this.config.defaultSymbol);
|
||||||
|
|
||||||
if (event.recurringEvent === true) {
|
if (event.recurringEvent === true && this.hasCalendarProperty(event.url, "recurringSymbol")) {
|
||||||
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "recurringSymbol", this.config.recurringSymbol), symbols);
|
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "recurringSymbol", this.config.defaultSymbol), symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.fullDayEvent === true) {
|
if (event.fullDayEvent === true && this.hasCalendarProperty(event.url, "fullDaySymbol")) {
|
||||||
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "fullDaySymbol", this.config.recurringSymbol), symbols);
|
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "fullDaySymbol", this.config.defaultSymbol), symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
return symbols;
|
return symbols;
|
||||||
@ -682,6 +680,10 @@ Module.register("calendar", {
|
|||||||
return p;
|
return p;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hasCalendarProperty: function (url, property) {
|
||||||
|
return !!this.getCalendarProperty(url, property, undefined);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortens a string if it's longer than maxLength and add a ellipsis to the end
|
* Shortens a string if it's longer than maxLength and add a ellipsis to the end
|
||||||
*
|
*
|
||||||
|
@ -22,6 +22,7 @@ let config = {
|
|||||||
config: {
|
config: {
|
||||||
calendars: [
|
calendars: [
|
||||||
{
|
{
|
||||||
|
symbol: "birthday-cake",
|
||||||
maximumEntries: 3,
|
maximumEntries: 3,
|
||||||
maximumNumberOfDays: 10000,
|
maximumNumberOfDays: 10000,
|
||||||
url: "http://localhost:8080/tests/configs/data/calendar_test.ics"
|
url: "http://localhost:8080/tests/configs/data/calendar_test.ics"
|
||||||
|
@ -37,6 +37,12 @@ describe("Calendar module", function () {
|
|||||||
const events = await app.client.$$(".calendar .event");
|
const events = await app.client.$$(".calendar .event");
|
||||||
return expect(events.length).equals(10);
|
return expect(events.length).equals(10);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should show the default calendar symbol in each event", async () => {
|
||||||
|
await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||||
|
const icons = await app.client.$$(".calendar .event .fa-calendar");
|
||||||
|
return expect(icons.length).not.equals(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Custom configuration", function () {
|
describe("Custom configuration", function () {
|
||||||
@ -50,6 +56,12 @@ describe("Calendar module", function () {
|
|||||||
const events = await app.client.$$(".calendar .event");
|
const events = await app.client.$$(".calendar .event");
|
||||||
return expect(events.length).equals(3);
|
return expect(events.length).equals(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should show the custom calendar symbol in each event", async () => {
|
||||||
|
await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||||
|
const icons = await app.client.$$(".calendar .event .fa-birthday-cake");
|
||||||
|
return expect(icons.length).not.equals(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Basic auth", function () {
|
describe("Basic auth", function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user