Merge pull request #2641 from rejas/issue_2462

Actually use showTime parameter in clock module
This commit is contained in:
Michael Teeuw 2021-08-31 09:22:32 +02:00 committed by GitHub
commit f71defe958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 690 additions and 651 deletions

View File

@ -11,7 +11,7 @@ _This release is scheduled to be released on 2021-10-01._
### Added
- Added showTime parameter to clock module for enabling/disabling time display in analog clock
- Added showTime parameter to clock module for enabling/disabling time display in digital clock
### Updated

View File

@ -19,7 +19,7 @@ Module.register("clock", {
showPeriodUpper: false,
clockBold: false,
showDate: true,
showTime: false,
showTime: true,
showWeek: false,
dateFormat: "dddd, LL",
@ -147,7 +147,7 @@ Module.register("clock", {
digitalWrapper.appendChild(dateWrapper);
}
if (this.config.showTime || this.config.displayType !== "analog") {
if (this.config.displayType !== "analog" && this.config.showTime) {
timeWrapper.innerHTML = timeString;
secondsWrapper.innerHTML = now.format("ss");
if (this.config.showPeriodUpper) {

1289
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -47,11 +47,11 @@
"devDependencies": {
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-jsdoc": "^36.0.7",
"eslint-plugin-jsdoc": "^36.0.8",
"eslint-plugin-prettier": "^3.4.1",
"express-basic-auth": "^1.2.0",
"husky": "^7.0.1",
"jest": "^27.0.6",
"husky": "^7.0.2",
"jest": "^27.1.0",
"jsdom": "^17.0.0",
"lodash": "^4.17.21",
"nyc": "^15.1.0",
@ -65,7 +65,7 @@
"stylelint-prettier": "^1.2.0"
},
"optionalDependencies": {
"electron": "^13.2.1"
"electron": "^13.2.3"
},
"dependencies": {
"colors": "^1.4.0",
@ -81,7 +81,7 @@
"moment": "^2.29.1",
"node-fetch": "^2.6.1",
"node-ical": "^0.13.0",
"simple-git": "^2.44.0",
"simple-git": "^2.45.0",
"socket.io": "^4.1.3"
},
"_moduleAliases": {

View File

@ -0,0 +1,23 @@
/* Magic Mirror Test config for default clock module
*
* By Johan Hammar
* MIT Licensed.
*/
let config = require(process.cwd() + "/tests/configs/default.js").configFactory({
timeFormat: 12,
modules: [
{
module: "clock",
position: "middle_center",
config: {
showTime: false
}
}
]
});
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@ -85,6 +85,19 @@ describe("Clock module", function () {
});
});
describe("with showTime config disabled", function () {
beforeAll(function () {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showTime.js";
});
it("should show not show the time when digital clock is shown", async function () {
await app.client.waitUntilWindowLoaded();
const time = await app.client.$$(".clock .digital .time");
return expect(time.length).toBe(0);
});
});
describe("with showWeek config enabled", function () {
beforeAll(function () {
// Set config sample for use in test