my-buds async add: render full row (anchor + the <Title> + data-tt-* attrs) so the appended entry's tooltip isn't empty — TDD

Adding a bud appended a stripped `@handle`-only <li> — no `applet-list-entry`
class, no bud-page anchor, no ` the <Title>` span, no data-tt-* attrs — so the
new row rendered without its title and its tooltip came up empty next to the
server-rendered rows above it.

- add_bud (billboard/views.py) — bud payload now carries `at_handle` (server-
  computed; the client can't replicate at_handle's truncate_email fallback for
  username-less buds) + `title` (active_title_display). IT asserts both.
- _bud_add_panel.html `_appendBudEntry` — rebuilt to mirror _my_buds_item.html
  exactly: both classes, data-tt-title/description/email/shoptalk, the
  bud-name anchor into /billboard/buds/<id>/, and the trailing ` the <Title>`.

New FT pins the regression: appended row carries the attrs + anchor + title and
its portal populates non-empty on row-lock. AddBudViewTest + append FT green.

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-29 11:56:31 -04:00
parent 3bf35ad539
commit af8452f22d
4 changed files with 92 additions and 10 deletions

View File

@@ -64,6 +64,47 @@ class MyBudsPageTest(FunctionalTest):
[],
))
def test_async_added_entry_matches_server_row_and_populates_tooltip(self):
"""Regression 2026-05-29: the async-appended row used to be a stripped
`@handle`-only `<li>` — no anchor, no ` the <Title>`, no data-tt-*
attrs — so its tooltip rendered empty (vs. the server-rendered rows
above it). The appended row must mirror _my_buds_item.html exactly."""
self.browser.get(self.live_server_url + "/billboard/my-buds/")
self.wait_for(lambda: self.browser.find_element(By.ID, "id_bud_btn")).click()
recipient = self.wait_for(lambda: self.browser.find_element(By.ID, "id_recipient"))
recipient.send_keys("alice@test.io")
self.browser.find_element(
By.CSS_SELECTOR, "#id_bud_panel .btn.btn-confirm"
).click()
sel = f".bud-entry[data-bud-id='{self.alice.id}']"
row = self.wait_for(lambda: self.browser.find_element(By.CSS_SELECTOR, sel))
# Carries both classes (styling + tooltip-lock both key on these).
cls = (row.get_attribute("class") or "").split()
self.assertIn("applet-list-entry", cls)
self.assertIn("bud-entry", cls)
# data-tt-* attrs the portal reads on row-lock.
self.assertEqual(row.get_attribute("data-tt-title"), "@alice")
self.assertEqual(row.get_attribute("data-tt-description"), "Earthman")
self.assertEqual(row.get_attribute("data-tt-email"), "alice@test.io")
# Anchor routes into the bud landing page; trailing ` the <Title>`.
anchor = row.find_element(By.CSS_SELECTOR, ".bud-name a")
self.assertIn(f"/billboard/buds/{self.alice.id}/", anchor.get_attribute("href"))
self.assertIn("the Earthman", row.find_element(
By.CSS_SELECTOR, ".bud-row-title"
).text)
# Click the row (NOT the anchor) → portal locks + populates non-empty.
row.find_element(By.CSS_SELECTOR, ".bud-row-title").click()
portal = self.wait_for(lambda: self.browser.find_element(
By.CSS_SELECTOR, "#id_tooltip_portal.active"
))
self.assertEqual(
portal.find_element(By.CSS_SELECTOR, ".tt-title").text, "@alice"
)
self.assertEqual(
portal.find_element(By.CSS_SELECTOR, ".tt-description").text, "Earthman"
)
def test_no_autocomplete_suggestions_on_my_buds_page(self):
"""The bud-autocomplete pool is request.user.buds — surfacing buds
you've already added on the page where you ADD new buds is just