feat: make mode creation preview-only and cache-safe
This commit is contained in:
@@ -175,3 +175,35 @@ def test_climate_control_circulation_and_outlet_are_not_conflated(render_rows):
|
||||
("空调出风模式", "吹面 / 吹脚"),
|
||||
("空调风量", "2档"),
|
||||
]
|
||||
|
||||
|
||||
def test_mode_preview_localizes_external_device_name_and_action_parameters(render_rows):
|
||||
rows = render_rows([
|
||||
{
|
||||
"domain": "self_extension",
|
||||
"capability": "infrared.emit",
|
||||
"target": {"device": "flashing-light", "name": "闪烁灯"},
|
||||
"parameters": {"action": "打开", "slot": 7},
|
||||
},
|
||||
])
|
||||
|
||||
assert [(row["label"], row["value"]) for row in rows] == [
|
||||
("闪烁灯", "动作:打开"),
|
||||
]
|
||||
assert "infrared.emit" not in json.dumps(rows, ensure_ascii=False)
|
||||
|
||||
|
||||
def test_default_bundle_rows_show_power_window_and_grouped_passenger_comfort(render_rows):
|
||||
rows = render_rows([
|
||||
action("climate.set_power", {"state": "on"}, "vehicle"),
|
||||
action("window.set_position", {"position_pct": 0}, "front_left"),
|
||||
action("seat.set_ventilation", {"state": "on", "level": 1}, "passenger"),
|
||||
action("seat.set_backrest_recline", {"position_pct": 45}, "passenger"),
|
||||
action("seat.set_legrest_height", {"position_pct": 35}, "passenger"),
|
||||
])
|
||||
|
||||
assert [(row["label"], row["value"]) for row in rows] == [
|
||||
("空调电源", "开启"),
|
||||
("主驾车窗", "完全关闭(目标开度 0%)"),
|
||||
("副驾座椅舒适模式", "通风开启 1档 · 靠背 45% · 腿托 35%"),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user