Rebase PR #5162 (rename busy_input_mode -> default_message_mode; flip the default from 'queue' to 'steer') onto current origin/master WITHOUT dropping the shipped #5170 localStorage persistence mirror. Rename the mirror machinery to the new setting name for consistency: _BUSY_INPUT_MODES -> _DEFAULT_MESSAGE_MODES (values unchanged) _normalizeBusyInputMode -> _normalizeDefaultMessageMode (fallback now 'steer') _persistBusyInputMode -> _persistDefaultMessageMode _readPersistedBusyInputMode -> _readPersistedDefaultMessageMode window._busyInputMode -> window._defaultMessageMode (+ renamed exports) localStorage: write the new 'hermes-default-message-mode' key; read it with a fallback to the legacy 'hermes-busy-input-mode' key so an existing user's persisted preference survives the rename. Preserve #5170 behavior at every mirror site under the new names: - boot success -> window._defaultMessageMode=_persistDefaultMessageMode(...) - boot FAILURE -> window._defaultMessageMode=_readPersistedDefaultMessageMode() (NOT a hardcoded 'steer' — a saved 'interrupt'/'queue' must still apply when the server is unreachable; do not regress #5167/#5132) - preferences autosave, settings-panel load, and _applySavedSettingsUi all persist through _persistDefaultMessageMode(...) Tests updated for the rename while keeping the persistence-behavior assertions (test_1062, test_5145, test_5167); test_5167 gains explicit guards that the load-failure path reads the persisted pref and never hardcodes a literal mode, plus autosave/panel-load mirror-write coverage. Co-authored-by: Rod Boev <rod.boev@gmail.com>
48 lines
2.3 KiB
Python
48 lines
2.3 KiB
Python
"""Regression coverage for busy-input settings search terms."""
|
|
from pathlib import Path
|
|
|
|
INDEX_HTML = (Path(__file__).parent.parent / "static" / "index.html").read_text(encoding="utf-8")
|
|
PANELS_JS = (Path(__file__).parent.parent / "static" / "panels.js").read_text(encoding="utf-8")
|
|
|
|
|
|
class TestBusyInputSettingsSearchTerms:
|
|
"""Busy-input settings search must cover option, descriptor, and supplemental text."""
|
|
|
|
def test_busy_input_field_has_supplemental_search_terms(self):
|
|
"""The busy-input field must expose the supplemental terms from HTML."""
|
|
assert 'data-settings-search="busy input mode message default while running queue interrupt steer"' in INDEX_HTML, (
|
|
"busy-input field must expose supplemental search terms in data-settings-search"
|
|
)
|
|
assert 'data-i18n="settings_label_default_message_mode"' in INDEX_HTML, (
|
|
"busy-input field label must stay wired to the renamed i18n key in the HTML"
|
|
)
|
|
|
|
def test_settings_index_uses_field_text_for_busy_input(self):
|
|
"""The index builder must include option and descriptor text in searchBlob."""
|
|
idx = PANELS_JS.find("function _buildSettingsIndex()")
|
|
assert idx >= 0, "_buildSettingsIndex not found"
|
|
body = PANELS_JS[idx:]
|
|
assert "searchBlob" in body, "_buildSettingsIndex must build a searchBlob"
|
|
assert "field.textContent" in body, "_buildSettingsIndex must include field text in searchBlob"
|
|
assert "settingsSearch" in body, (
|
|
"_buildSettingsIndex must include supplemental data-settings-search terms in searchBlob"
|
|
)
|
|
|
|
def test_filter_settings_uses_search_blob_and_keeps_label_rendering(self):
|
|
"""filterSettings must rank by source and keep visible labels."""
|
|
idx = PANELS_JS.find("function filterSettings(query)")
|
|
assert idx >= 0, "filterSettings not found"
|
|
body = PANELS_JS[idx:]
|
|
assert "esc(m.label)" in body, (
|
|
"filterSettings must keep rendering the visible label"
|
|
)
|
|
assert ".slice(0, 12)" in body, (
|
|
"filterSettings must keep the existing 12-result cap"
|
|
)
|
|
assert ".sort(" in body, (
|
|
"filterSettings must apply deterministic ranking"
|
|
)
|
|
assert "_scoreSettingsSearchMatch" in body, (
|
|
"filterSettings must score ranked matches by source"
|
|
)
|