diff options
Diffstat (limited to 'packages/meshbay-hub/tests/test_spa_ordering.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_spa_ordering.py | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/packages/meshbay-hub/tests/test_spa_ordering.py b/packages/meshbay-hub/tests/test_spa_ordering.py index 9d02d42..1556cb7 100644 --- a/packages/meshbay-hub/tests/test_spa_ordering.py +++ b/packages/meshbay-hub/tests/test_spa_ordering.py @@ -125,24 +125,67 @@ def _component(name: str) -> str: return source[start:end if end != -1 else len(source)] -def test_members_panel_renders_what_it_owns(): - panel = _component("MembersPanel") +def test_the_group_settings_panel_renders_what_it_owns(): + panel = _component("GroupSettingsPanel") assert "members.map(" in panel, "the member list is not rendered" assert "onSubmit=${doInvite}" in panel, "the invite form is not rendered" assert "onSubmit=${doPair}" in panel, "the pairing form is not rendered" + assert "device.mine_title" in panel, "the devices section is not rendered" -def test_the_invite_form_comes_before_the_list(): - panel = _component("MembersPanel") - assert panel.index("onSubmit=${doInvite}") < panel.index("members.map("), \ - "the invite form belongs above the member list" +def test_the_roster_comes_last(): + """ + It is the only part of this tab with no upper bound. Two hundred members + would put every form and every control below the fold, which is what the + order is for — asked for in those terms. + """ + panel = _component("GroupSettingsPanel") + listing = panel.index("members.map(") + for name, marker in (("the invite form", "onSubmit=${doInvite}"), + ("the pairing form", "onSubmit=${doPair}"), + ("the devices section", "device.mine_title"), + ("leaving and deleting", "members.danger_title")): + assert panel.index(marker) < listing, f"{name} belongs above the roster" + + +def test_leaving_a_group_lives_with_the_group_settings(): + """It used to sit in the page header beside the group's name, which is + neither where it belongs nor where anyone looked for it.""" + panel = _component("GroupSettingsPanel") + assert "group.leave_confirm" in panel and "group.delete_group_confirm" in panel + page = _component("GroupPage") + assert "group.leave_confirm" not in page, "still in the header as well" + + +def test_leaving_does_not_require_the_node_to_be_up(): + """ + Moving these into a tab that only rendered on a live connection would have + made them unreachable exactly when a node is down — which is when someone + most wants to leave. Membership is hub-side; the tab bar does not wait for + the node. + """ + page = _component("GroupPage") + tabs = page[page.index("group-tabs"):] + tabs = tabs[:tabs.index("</div>")] + before = page[:page.index("group-tabs")] + guard = before[before.rindex("${"):] + assert "status === 'connected'" not in guard, ( + "the tab bar is gated on the connection, so a group on an offline node " + "cannot be left") + + +def test_the_node_dependent_sections_say_when_the_node_is_down(): + """The other half of that: inviting needs the node to wrap the group key, + so it must explain itself rather than silently doing nothing.""" + panel = _component("GroupSettingsPanel") + assert "connected &&" in panel and "!connected &&" in panel -def test_admin_page_does_not_borrow_the_members_panel_state(): +def test_admin_page_does_not_borrow_the_group_settings_state(): admin = _component("AdminPage") for name in ("doInvite", "adminId", "inviteCode", "setInviteUser"): assert name not in admin, \ - f"AdminPage references {name}, which only exists in MembersPanel" + f"AdminPage references {name}, which only exists in GroupSettingsPanel" # ── Upload pipelining ─────────────────────────────────────────────────────── |