mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Bug fix: adding date to the analog clock if showDate is true (#3101)
Adding date to the clock module when displayType is "analog" and "showDate" is true. The setting in analogShowDate is respected. Fixes #3100 --------- Co-authored-by: Michael Teeuw <michael@xonaymedia.nl> Co-authored-by: Veeck <github@veeck.de>
This commit is contained in:
parent
432d900ecd
commit
babd22b04f
@ -33,6 +33,7 @@ _This release is scheduled to be released on 2023-07-01._
|
|||||||
- Fix electron not running under windows after async changes (#3083)
|
- Fix electron not running under windows after async changes (#3083)
|
||||||
- Fix style issues after eslint-plugin-jsdoc update
|
- Fix style issues after eslint-plugin-jsdoc update
|
||||||
- Fix don't filter out ongoing full day events (#3095)
|
- Fix don't filter out ongoing full day events (#3095)
|
||||||
|
- Fix date not shown when clock in analog mode (#3100)
|
||||||
|
|
||||||
## [2.23.0] - 2023-04-04
|
## [2.23.0] - 2023-04-04
|
||||||
|
|
||||||
|
@ -281,9 +281,14 @@ Module.register("clock", {
|
|||||||
*/
|
*/
|
||||||
if (this.config.displayType === "analog") {
|
if (this.config.displayType === "analog") {
|
||||||
// Display only an analog clock
|
// Display only an analog clock
|
||||||
if (this.config.analogShowDate === "top") {
|
if (this.config.showDate) {
|
||||||
|
// Add date to the analog clock
|
||||||
|
dateWrapper.innerHTML = now.format(this.config.dateFormat);
|
||||||
|
wrapper.appendChild(dateWrapper);
|
||||||
|
}
|
||||||
|
if (this.config.analogShowDate === "bottom") {
|
||||||
wrapper.classList.add("clock-grid-bottom");
|
wrapper.classList.add("clock-grid-bottom");
|
||||||
} else if (this.config.analogShowDate === "bottom") {
|
} else if (this.config.analogShowDate === "top") {
|
||||||
wrapper.classList.add("clock-grid-top");
|
wrapper.classList.add("clock-grid-top");
|
||||||
}
|
}
|
||||||
wrapper.appendChild(analogWrapper);
|
wrapper.appendChild(analogWrapper);
|
||||||
|
@ -9,7 +9,8 @@ let config = {
|
|||||||
position: "middle_center",
|
position: "middle_center",
|
||||||
config: {
|
config: {
|
||||||
displayType: "analog",
|
displayType: "analog",
|
||||||
analogFace: "face-006"
|
analogFace: "face-006",
|
||||||
|
showDate: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
25
tests/configs/modules/clock/clock_showDateAnalog.js
Normal file
25
tests/configs/modules/clock/clock_showDateAnalog.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* MagicMirror² Test config for default clock module
|
||||||
|
*
|
||||||
|
* By Johan Hammar
|
||||||
|
* MIT Licensed.
|
||||||
|
*/
|
||||||
|
let config = {
|
||||||
|
timeFormat: 12,
|
||||||
|
|
||||||
|
modules: [
|
||||||
|
{
|
||||||
|
module: "clock",
|
||||||
|
position: "middle_center",
|
||||||
|
config: {
|
||||||
|
showTime: true,
|
||||||
|
showDate: true,
|
||||||
|
displayType: "analog"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||||
|
if (typeof module !== "undefined") {
|
||||||
|
module.exports = config;
|
||||||
|
}
|
@ -107,4 +107,18 @@ describe("Clock module", () => {
|
|||||||
expect(elem).not.toBe(null);
|
expect(elem).not.toBe(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("with analog clock face and date enabled", () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
await helpers.startApplication("tests/configs/modules/clock/clock_showDateAnalog.js");
|
||||||
|
await helpers.getDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should show the analog clock face and the date", async () => {
|
||||||
|
const elemClock = helpers.waitForElement(".clock-circle");
|
||||||
|
await expect(elemClock).not.toBe(null);
|
||||||
|
const elemDate = helpers.waitForElement(".clock .date");
|
||||||
|
await expect(elemDate).not.toBe(null);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user