mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Add test setup for custom calendar configuration
This commit is contained in:
parent
530c5d416a
commit
a391445e5f
@ -207,7 +207,7 @@ Module.register("calendar", {
|
|||||||
eventWrapper.style.cssText = "color:" + this.colorForUrl(event.url);
|
eventWrapper.style.cssText = "color:" + this.colorForUrl(event.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
eventWrapper.className = "normal";
|
eventWrapper.className = "normal event";
|
||||||
|
|
||||||
if (this.config.displaySymbol) {
|
if (this.config.displaySymbol) {
|
||||||
var symbolWrapper = document.createElement("td");
|
var symbolWrapper = document.createElement("td");
|
||||||
|
38
tests/configs/modules/calendar/custom.js
Normal file
38
tests/configs/modules/calendar/custom.js
Normal file
@ -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;
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
const helpers = require("../global-setup");
|
const helpers = require("../global-setup");
|
||||||
const serverBasicAuth = require("../../servers/basic-auth.js");
|
const serverBasicAuth = require("../../servers/basic-auth.js");
|
||||||
|
const expect = require("chai").expect;
|
||||||
|
|
||||||
const describe = global.describe;
|
const describe = global.describe;
|
||||||
const it = global.it;
|
const it = global.it;
|
||||||
@ -31,8 +32,23 @@ describe("Calendar module", function () {
|
|||||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should return TestEvents", function () {
|
it("Should show the default maximumEntries of 10", async () => {
|
||||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user