Revert "fix: address mobile dashboard review findings"
This reverts commit 1039bb18b3.
This commit is contained in:
1 parent
2f99f1f34b
commit
cd8773681f
12 files changed
+11
-103
No files matched your search
@@ -1,20 +0,0 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { getPreferredUnit } from "./temperature";
|
||||
|
||||
describe("getPreferredUnit", () => {
|
||||
test("preserves zero in Celsius and Fahrenheit", () => {
|
||||
expect(getPreferredUnit(0)).toBe("0.0°C");
|
||||
expect(getPreferredUnit(0, true)).toBe("32.0°F");
|
||||
});
|
||||
|
||||
test("only uses the unavailable placeholder for missing values", () => {
|
||||
expect(getPreferredUnit(undefined)).toBe("?");
|
||||
});
|
||||
|
||||
test("respects the decimal preference", () => {
|
||||
expect(getPreferredUnit(0, false, true)).toBe("0°C");
|
||||
expect(getPreferredUnit(0, true, true)).toBe("32°F");
|
||||
expect(getPreferredUnit(12.6, false, true)).toBe("13°C");
|
||||
});
|
||||
});
|
||||
@@ -1,6 +0,0 @@
|
||||
export const getPreferredUnit = (value?: number, isFahrenheit = false, disableTemperatureDecimals = false): string =>
|
||||
value !== undefined
|
||||
? isFahrenheit
|
||||
? `${(value * (9 / 5) + 32).toFixed(disableTemperatureDecimals ? 0 : 1)}°F`
|
||||
: `${value.toFixed(disableTemperatureDecimals ? 0 : 1)}°C`
|
||||
: "?";
|
||||
Reference in new issue
Block a user