✅ Fix JS Unit tests & add one

This commit is contained in:
Gina Häußge committed 2023-12-04 16:21:33 +01:00
1 parent c837cb6d94
commit 6e57ab6b23
2 files changed
+9 -1

No files matched your search

+1 -1
View File
@@ -655,7 +655,7 @@ function cleanTemperature(temp, offThreshold) {
}
function formatTemperature(temp, showF, offThreshold, returnUnicode) {
if (temp === undefined || isNaN(temp)) return "-";
if (temp === undefined || !_.isNumber(temp) || isNaN(temp)) return "-";
if (offThreshold !== undefined && temp < offThreshold) return gettext("off");
var degreeSymbol = "&deg;";
+8
View File
@@ -105,6 +105,14 @@ QUnit.cases(
offThreshold: undefined,
expected: "-"
},
{
title: "NaNTemperature",
input: NaN,
showF: undefined,
useUnicode: undefined,
offThreshold: undefined,
expected: "-"
},
{
title: "TemperatureUnderOffThreshold",
input: 1.0,