Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions esphome_device_builder/models/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class UserPreferences(DataClassORJSONMixin):
navigator_visible: bool = True
yaml_diff_button: bool = False

# Frontend "Expert Mode" master switch: gates the editor diff view, the
# device-navigator search box, and the command-palette YAML content search.
expert_mode: bool = False

# Table view settings
table_page_size: int = 25
table_column_visibility: dict[str, bool] = field(default_factory=dict)
Expand Down
9 changes: 9 additions & 0 deletions tests/test_config_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,15 @@ async def test_set_prefs_merges_partial_update(tmp_path: Path) -> None:
assert controller.prefs.snapshot() == result


async def test_set_prefs_persists_expert_mode(tmp_path: Path) -> None:
"""The frontend's Expert Mode toggle round-trips through set/get prefs."""
controller = _make_controller(tmp_path)

result = await controller.set_prefs(expert_mode=True)
assert result.expert_mode is True
assert (await controller.get_prefs()).expert_mode is True


async def test_set_prefs_concurrent_updates_do_not_lose_writes(tmp_path: Path) -> None:
"""Partial updates of distinct fields all survive on the RAM-canonical store.

Expand Down
Loading