buddy btn sprint: banner-anchor + window.Brief fix lands the last red FT — 16/16 buddy + 12 share/jasmine/my_notes + 818 IT regression — TDD

Two small fixes close out the OK→banner gap:

1. Anchor over h2: base.html drops <div id="id_brief_banner_anchor"></div> right before {% block content %} (after the messages block). note.js's showBanner now prefers the explicit anchor over the first <h2> — keeps the banner in the visible content flow on pages where the first h2 is position:absolute (post.html's rotated navbar header was the immediate motivator; sky.html's rotated h2 is the same shape, so this catches that pre-emptively too).
2. window.Brief explicit assignment: const Brief = (...) at script-tag scope is reachable as a bare name but does NOT auto-attach to window. The buddy panel's OK handler gates banner reveal on `if (window.Brief && data.brief)` — that gate was always false, so Brief.showBanner never fired on share-OK even though the chip + Line append in DOM proved the fetch.then() was running. Explicit window.Brief = Brief; window.Note = Note; in note.js (post-IIFE) closes the gap.

Also picks up the deferred page-object update — functional_tests.post_page.PostPage.share_post_with() now drives the buddy-btn flow (click #id_buddy_btn → type → click #id_buddy_panel .btn.btn-confirm → wait for recipient chip), so legacy SharingTest exercises the new pipeline end-to-end.

NoteSpec.js T10 split into T10a/T10b: a covers the anchor-preferred path, b covers the <h2> fallback.

16/16 buddy FTs green (previously 15/16). 12/12 sharing + Jasmine + my_notes FTs green. 818-test IT sweep green.

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-08 19:14:50 -04:00
parent e465b6a3b3
commit ba5f6556c0
5 changed files with 53 additions and 9 deletions

View File

@@ -118,9 +118,17 @@ describe('Brief.showBanner', () => {
expect(document.querySelector('.note-banner')).toBeNull();
});
// ── T10 ── placement after h2 ─────────────────────────────────────────────
// ── T10 ── placement: anchor preferred over h2 ───────────────────────────
it('T10: banner is inserted immediately after the first h2 in the document', () => {
it('T10a: banner is inserted as nextSibling of #id_brief_banner_anchor when present', () => {
const anchor = document.createElement('div');
anchor.id = 'id_brief_banner_anchor';
fixture.appendChild(anchor);
Brief.showBanner(SAMPLE_BRIEF);
expect(anchor.nextElementSibling.classList.contains('note-banner')).toBeTrue();
});
it('T10b: falls back to inserting after the first h2 when anchor is absent', () => {
Brief.showBanner(SAMPLE_BRIEF);
const h2 = fixture.querySelector('h2');
expect(h2.nextElementSibling.classList.contains('note-banner')).toBeTrue();