diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index f8af4a8f..d0dd4022 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -207,7 +207,7 @@ Module.register("calendar", { eventWrapper.style.cssText = "color:" + this.colorForUrl(event.url); } - eventWrapper.className = "normal"; + eventWrapper.className = "normal event"; if (this.config.displaySymbol) { var symbolWrapper = document.createElement("td"); diff --git a/tests/configs/modules/calendar/custom.js b/tests/configs/modules/calendar/custom.js new file mode 100644 index 00000000..2060bb1c --- /dev/null +++ b/tests/configs/modules/calendar/custom.js @@ -0,0 +1,38 @@ +/* Magic Mirror Test config custom calendar + * + * MIT Licensed. + */ +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + + language: "en", + timeFormat: 12, + units: "metric", + electronOptions: { + webPreferences: { + nodeIntegration: true + } + }, + + modules: [ + { + module: "calendar", + position: "bottom_bar", + config: { + calendars: [ + { + maximumEntries: 3, + maximumNumberOfDays: 10000, + url: "http://localhost:8080/tests/configs/data/calendar_test.ics" + } + ] + } + } + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/e2e/modules/calendar_spec.js b/tests/e2e/modules/calendar_spec.js index 7af78201..19501158 100644 --- a/tests/e2e/modules/calendar_spec.js +++ b/tests/e2e/modules/calendar_spec.js @@ -1,5 +1,6 @@ const helpers = require("../global-setup"); const serverBasicAuth = require("../../servers/basic-auth.js"); +const expect = require("chai").expect; const describe = global.describe; const it = global.it; @@ -31,8 +32,23 @@ describe("Calendar module", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js"; }); - it("Should return TestEvents", function () { - return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); + it("Should show the default maximumEntries of 10", async () => { + await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); + const events = await app.client.$$(".calendar .event"); + return expect(events.length).equals(10); + }); + }); + + describe("Custom configuration", function () { + before(function () { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/custom.js"; + }); + + it("Should show the custom maximumEntries of 3", async () => { + await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); + const events = await app.client.$$(".calendar .event"); + return expect(events.length).equals(3); }); });