mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Fix precipitation styles (#3041)
They weren't applied to wrong classnames, this PR fixes that and also expands the weather util tests --------- Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
@@ -79,6 +79,15 @@ describe("Weather module: Weather Forecast", () => {
|
||||
expect(table.rows).not.toBe(null);
|
||||
expect(table.rows.length).toBe(5);
|
||||
});
|
||||
|
||||
const precipitations = [undefined, "2.51 mm"];
|
||||
for (const [index, precipitation] of precipitations.entries()) {
|
||||
if (precipitation) {
|
||||
it("should render precipitation amount " + precipitation, async () => {
|
||||
await weatherFunc.getText(`.weather table tr:nth-child(${index + 1}) td.precipitation-amount`, precipitation);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
describe("Forecast weather with imperial units", () => {
|
||||
@@ -99,8 +108,8 @@ describe("Weather module: Weather Forecast", () => {
|
||||
const precipitations = [undefined, "0.10 in"];
|
||||
for (const [index, precipitation] of precipitations.entries()) {
|
||||
if (precipitation) {
|
||||
it("should render precipitation value " + precipitation, async () => {
|
||||
await weatherFunc.getText(`.weather table.small tr:nth-child(${index + 1}) td.precipitationAmount`, precipitation);
|
||||
it("should render precipitation amount " + precipitation, async () => {
|
||||
await weatherFunc.getText(`.weather table.small tr:nth-child(${index + 1}) td.precipitation-amount`, precipitation);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -44,18 +44,18 @@ describe("Weather module: Weather Hourly Forecast", () => {
|
||||
for (const [index, amount] of amounts.entries()) {
|
||||
if (amount) {
|
||||
it(`should render precipitation amount ${amount}`, async () => {
|
||||
await weatherFunc.getText(`.weather table.small tr:nth-child(${index + 1}) td.precipitationAmount`, amount);
|
||||
await weatherFunc.getText(`.weather table.small tr:nth-child(${index + 1}) td.precipitation-amount`, amount);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
describe("Shows precipitation propability", () => {
|
||||
describe("Shows precipitation probability", () => {
|
||||
const propabilities = [undefined, undefined, "12%", "36%", "44%"];
|
||||
for (const [index, pop] of propabilities.entries()) {
|
||||
if (pop) {
|
||||
it(`should render propability ${pop}`, async () => {
|
||||
await weatherFunc.getText(`.weather table.small tr:nth-child(${index + 1}) td.precipitationProbability`, pop);
|
||||
it(`should render probability ${pop}`, async () => {
|
||||
await weatherFunc.getText(`.weather table.small tr:nth-child(${index + 1}) td.precipitation-prob`, pop);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,15 @@ describe("WeatherObject", () => {
|
||||
describe("WeatherUtils", () => {
|
||||
it("should convert windspeed correctly from mps to beaufort", () => {
|
||||
expect(Math.round(WeatherUtils.convertWind(5, "beaufort"))).toBe(3);
|
||||
expect(Math.round(WeatherUtils.convertWind(42, "beaufort"))).toBe(12);
|
||||
expect(Math.round(WeatherUtils.convertWind(300, "beaufort"))).toBe(12);
|
||||
});
|
||||
|
||||
it("should convert windspeed correctly from mps to kmh", () => {
|
||||
expect(Math.round(WeatherUtils.convertWind(11.75, "kmh"))).toBe(42);
|
||||
});
|
||||
|
||||
it("should convert windspeed correctly from mps to knots", () => {
|
||||
expect(Math.round(WeatherUtils.convertWind(10, "knots"))).toBe(19);
|
||||
});
|
||||
|
||||
it("should convert windspeed correctly from mph to mps", () => {
|
||||
|
Reference in New Issue
Block a user