Merge branch 'develop' into develop

This commit is contained in:
Ezequiel Holzweissig 2021-04-13 20:56:32 -03:00 committed by GitHub
commit d6ab56252f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 9037 additions and 67 deletions

View File

@ -14,6 +14,7 @@ _This release is scheduled to be released on 2021-04-01._
- Added French translations for "MODULE_CONFIG_ERROR" and "PRECIP".
- Added German translation for "PRECIP".
- Added first test for Alert module.
- Added support for `dateFormat` when not using `timeFormat: "absolute"`
### Updated
@ -26,7 +27,9 @@ _This release is scheduled to be released on 2021-04-01._
- Fix calendar start function logging inconsistency.
- Fix updatenotification start function logging inconsistency.
- Checks and applies the showDescription setting for the newsfeed module again
- Fix tests in weather module and add one for decimalPoint in forecast
- Fix decimalSymbol in the forcast part of the new weather module #2530
- Fix wrong treatment of `appendLocationNameToHeader` when using `ukmetofficedatahub`
- Fix alert not recognizing multiple alerts (#2522)
## [2.15.0] - 2021-04-01

View File

@ -1,7 +1,21 @@
{
"name": "magicmirror-fonts",
"lockfileVersion": 2,
"requires": true,
"lockfileVersion": 1,
"packages": {
"": {
"name": "magicmirror-fonts",
"license": "MIT",
"dependencies": {
"roboto-fontface": "^0.10.0"
}
},
"node_modules/roboto-fontface": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/roboto-fontface/-/roboto-fontface-0.10.0.tgz",
"integrity": "sha512-OlwfYEgA2RdboZohpldlvJ1xngOins5d7ejqnIBWr9KaMxsnBqotpptRXTyfNRLnFpqzX6sTDt+X+a+6udnU8g=="
}
},
"dependencies": {
"roboto-fontface": {
"version": "0.10.0",

View File

@ -366,13 +366,14 @@ Module.register("calendar", {
if (event.startDate >= now) {
// Use relative time
if (!this.config.hideTime) {
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar());
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar(null, { sameElse: this.config.dateFormat }));
} else {
timeWrapper.innerHTML = this.capFirst(
moment(event.startDate, "x").calendar(null, {
sameDay: "[" + this.translate("TODAY") + "]",
nextDay: "[" + this.translate("TOMORROW") + "]",
nextWeek: "dddd"
nextWeek: "dddd",
sameElse: this.config.dateFormat
})
);
}

View File

@ -59,9 +59,7 @@ WeatherProvider.register("ukmetofficedatahub", {
let queryStrings = "?";
queryStrings += "latitude=" + this.config.lat;
queryStrings += "&longitude=" + this.config.lon;
if (this.config.appendLocationNameToHeader) {
queryStrings += "&includeLocationName=" + true;
}
// Return URL, making sure there is a trailing "/" in the base URL.
return this.config.apiBase + (this.config.apiBase.endsWith("/") ? "" : "/") + forecastType + queryStrings;

8898
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
/* Magic Mirror Test config default weather
*
* By rejas
* MIT Licensed.
*/
let config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 24,
units: "imperial",
electronOptions: {
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true
}
},
modules: [
{
module: "weather",
position: "bottom_bar",
config: {
type: "forecast",
location: "Munich",
apiKey: "fake key",
weatherEndpoint: "/forecast/daily",
initialLoadDelay: 3000,
decimalSymbol: "_"
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@ -139,7 +139,7 @@ describe("Weather module", function () {
const weather = generateWeather();
await setup({ template, data: weather });
return getText(".weather .large.light span.bright", "1°C") && getText(".weather .normal.medium.feelslike span.dimmed", "Feels like -6°C");
return (await getText(".weather .large.light span.bright", "1°C")) && (await getText(".weather .normal.medium.feelslike span.dimmed", "Feels like -6°C"));
});
});
@ -161,10 +161,10 @@ describe("Weather module", function () {
});
await setup({ template, data: weather });
return getText(".weather .normal.medium span:nth-child(2)", "6 WSW") && getText(".weather .large.light span.bright", "34,7°") && getText(".weather .normal.medium.feelslike span.dimmed", "Feels like 22,0°");
return (await getText(".weather .normal.medium span:nth-child(2)", "6 WSW")) && (await getText(".weather .large.light span.bright", "34,7°")) && getText(".weather .normal.medium.feelslike span.dimmed", "Feels like 22,0°");
});
it("should render decimalSymbol = ','", async function () {
it("should render custom decimalSymbol = ','", async function () {
const weather = generateWeather({
main: {
temp: (1.49 * 9) / 5 + 32,
@ -177,7 +177,7 @@ describe("Weather module", function () {
});
await setup({ template, data: weather });
return getText(".weather .normal.medium span:nth-child(3)", "93,7") && getText(".weather .large.light span.bright", "34,7°") && getText(".weather .normal.medium.feelslike span.dimmed", "Feels like 22,0°");
return (await getText(".weather .normal.medium span:nth-child(3)", "93,7")) && (await getText(".weather .large.light span.bright", "34,7°")) && getText(".weather .normal.medium.feelslike span.dimmed", "Feels like 22,0°");
});
});
});
@ -201,7 +201,7 @@ describe("Weather module", function () {
const days = ["Today", "Tomorrow", "Sun", "Mon", "Tue"];
for (const [index, day] of days.entries()) {
getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(1)`, day);
await getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(1)`, day);
}
});
@ -212,7 +212,7 @@ describe("Weather module", function () {
const icons = ["day-cloudy", "rain", "day-sunny", "day-sunny", "day-sunny"];
for (const [index, icon] of icons.entries()) {
getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(2) span.wi-${icon}`);
await getElement(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(2) span.wi-${icon}`);
}
});
@ -223,7 +223,7 @@ describe("Weather module", function () {
const temperatures = ["24.4°", "21.0°", "22.9°", "23.4°", "20.6°"];
for (const [index, temp] of temperatures.entries()) {
getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(3)`, temp);
await getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(3)`, temp);
}
});
@ -234,7 +234,7 @@ describe("Weather module", function () {
const temperatures = ["15.3°", "13.6°", "13.8°", "13.9°", "10.9°"];
for (const [index, temp] of temperatures.entries()) {
getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(4)`, temp);
await getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(4)`, temp);
}
});
@ -274,5 +274,22 @@ describe("Weather module", function () {
expect(rows.length).to.be.equal(5);
});
});
describe("Forecast weather units", function () {
before(function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/forecastweather_units.js";
});
it("should render custom decimalSymbol = '_'", async function () {
const weather = generateWeatherForecast();
await setup({ template, data: weather });
const temperatures = ["24_4°", "21_0°", "22_9°", "23_4°", "20_6°"];
for (const [index, temp] of temperatures.entries()) {
await getText(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(3)`, temp);
}
});
});
});
});

88
vendor/package-lock.json generated vendored
View File

@ -1,7 +1,93 @@
{
"name": "magicmirror-vendors",
"lockfileVersion": 2,
"requires": true,
"lockfileVersion": 1,
"packages": {
"": {
"name": "magicmirror-vendors",
"license": "MIT",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.3",
"moment": "^2.29.1",
"moment-timezone": "^0.5.33",
"nunjucks": "^3.2.3",
"suncalc": "^1.8.0",
"weathericons": "^2.1.0"
}
},
"node_modules/@fortawesome/fontawesome-free": {
"version": "5.15.3",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.3.tgz",
"integrity": "sha512-rFnSUN/QOtnOAgqFRooTA3H57JLDm0QEG/jPdk+tLQNL/eWd+Aok8g3qCI+Q1xuDPWpGW/i9JySpJVsq8Q0s9w==",
"hasInstallScript": true,
"engines": {
"node": ">=6"
}
},
"node_modules/a-sync-waterfall": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz",
"integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA=="
},
"node_modules/asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
},
"node_modules/commander": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",
"integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==",
"engines": {
"node": ">= 6"
}
},
"node_modules/moment": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==",
"engines": {
"node": "*"
}
},
"node_modules/moment-timezone": {
"version": "0.5.33",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.33.tgz",
"integrity": "sha512-PTc2vcT8K9J5/9rDEPe5czSIKgLoGsH8UNpA4qZTVw0Vd/Uz19geE9abbIOQKaAQFcnQ3v5YEXrbSc5BpshH+w==",
"dependencies": {
"moment": ">= 2.9.0"
},
"engines": {
"node": "*"
}
},
"node_modules/nunjucks": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.3.tgz",
"integrity": "sha512-psb6xjLj47+fE76JdZwskvwG4MYsQKXUtMsPh6U0YMvmyjRtKRFcxnlXGWglNybtNTNVmGdp94K62/+NjF5FDQ==",
"dependencies": {
"a-sync-waterfall": "^1.0.0",
"asap": "^2.0.3",
"commander": "^5.1.0"
},
"bin": {
"nunjucks-precompile": "bin/precompile"
},
"engines": {
"node": ">= 6.9.0"
}
},
"node_modules/suncalc": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/suncalc/-/suncalc-1.8.0.tgz",
"integrity": "sha1-HZiYEJVjB4dQ9JlKlZ5lTYdqy/U="
},
"node_modules/weathericons": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/weathericons/-/weathericons-2.1.0.tgz",
"integrity": "sha1-dFOho14gAkXjiftQd9Un7/MLc7Q="
}
},
"dependencies": {
"@fortawesome/fontawesome-free": {
"version": "5.15.3",