mirror of
https://github.com/home-assistant/frontend.git
synced 2026-04-19 00:12:51 +01:00
* Add "Commands" title to quick bar translations in English * Enhance QuickBar dialog handling and localize commands title * add nav icons * Add icons and styles and separate navigation from commands * handle non admin * Add areas * Fix import and shortcuts * Restructure * remove area sort * move keys * area search keys review * Fix adaptive dialog slots without header * Design review * Review marcin * Fix safe area bottom * Fix ios focus * Make it clearable --------- Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
30 lines
1012 B
TypeScript
30 lines
1012 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { computeAreaName } from "../../../src/common/entity/compute_area_name";
|
|
import type { AreaRegistryEntry } from "../../../src/data/area/area_registry";
|
|
|
|
describe("computeAreaName", () => {
|
|
it("returns the trimmed name if present", () => {
|
|
const area: AreaRegistryEntry = {
|
|
name: "Living Room",
|
|
} as AreaRegistryEntry;
|
|
expect(computeAreaName(area)).toBe("Living Room");
|
|
});
|
|
|
|
it("trims whitespace from the name", () => {
|
|
const area: AreaRegistryEntry = {
|
|
name: " Kitchen ",
|
|
} as AreaRegistryEntry;
|
|
expect(computeAreaName(area)).toBe("Kitchen");
|
|
});
|
|
|
|
it("returns undefined if name is missing", () => {
|
|
const area: AreaRegistryEntry = {} as AreaRegistryEntry;
|
|
expect(computeAreaName(area)).toBeUndefined();
|
|
});
|
|
|
|
it("returns empty string if name is only whitespace", () => {
|
|
const area: AreaRegistryEntry = { name: " " } as AreaRegistryEntry;
|
|
expect(computeAreaName(area)).toBe("");
|
|
});
|
|
});
|