Stop presenter screens reload-looping; stack flow regions on phones
B3: the presenter view and phone remote never carried data-slide, so present.js read slide 0 and reloaded on every stream event (~100 loads in 3s). Both templates now render the 1-based slide, and present.js reloads at most once per state, which also covers a deck shortened mid-talk (eventFor publishes an unclamped slide; follow-up). B4: the phone container-query rule lost on specificity to the named region placements, so headings painted over body text on every flow slide in the viewer, share links and the editor's Phone/Both views. Reviewed by Fable 5.1 on discussion #13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from fix/r1-present-reload-phone-regions into main.
9 files changed,
+341
−12
internal/slides/credits/assets.json+1 −1internal/slides/presentation.go+12 −2internal/slides/static/present.js+42 −7internal/slides/static/slides.css+11 −2internal/slides/templates/present_notes.html+1 −0internal/slides/templates/remote.html+1 −0internal/slidestest/browser_phone_test.go+135 −0internal/slidestest/browser_present_test.go+108 −0internal/slidestest/present_test.go+30 −0
CI passed — run details
diff --git a/internal/slides/credits/assets.json b/internal/slides/credits/assets.json| index 17768b0..02d1e1d 100644 |
| --- a/internal/slides/credits/assets.json |
| +++ b/internal/slides/credits/assets.json |
| @@ -42,7 +42,7 @@ |
| "internal/slides/static/fonts/LiberationSerif-BoldItalic.ttf": "4b2635d2ec4d992373dcae577c742a98ecfd841ffc1b8a103b5f10db163dbc7a", |
| "internal/slides/static/fonts/LiberationSerif-Italic.ttf": "de18fe26337e03241952dca46398d5b66f3c5738d080bfd284f66e67b926f597", |
| "internal/slides/static/fonts/LiberationSerif-Regular.ttf": "9caef765d2e891c10dd73658894f01e660fe0c1c83e0bda7d6edf561d8f623d4", |
| - "internal/slides/static/present.js": "da431f7e84127fcdde770feda45f0c719c8b7fa4d2a5d698fdd1dc45465977a3", |
| + "internal/slides/static/present.js": "a28c9d039e5ca3ae09e4de3e1bc2ee2c7950458606962269f95477fd1f3a6424", |
| "internal/slides/static/rastrillo.js": "3489c972007390ee955d3592583406a20ad8f57993a73d56f545ef06870b8c58", |
| "internal/slides/static/select.js": "6a9548abfb177f65361fcfc4333d9b0a068cec6b9acf8d7eada05591409584a0", |
| "rust-toolchain.toml": "88bc3a3493bc98cad9f5bc5b4f8948739e1a418d8367373bb9b854fecaf5edc6" |
diff --git a/internal/slides/presentation.go b/internal/slides/presentation.go| index 8cf083a..4e99a54 100644 |
| --- a/internal/slides/presentation.go |
| +++ b/internal/slides/presentation.go |
| @@ -472,6 +472,7 @@ type presenterPage struct { |
| Session string |
| Token string |
| + Now int |
| Counter string |
| CurrentLabel string |
| Current template.HTML |
| @@ -521,6 +522,7 @@ type remotePage struct { |
| DeckTitle string |
| Session string |
| + Now int |
| Counter string |
| CurrentLabel string |
| Current template.HTML |
| @@ -792,7 +794,7 @@ func (a *app) presenterNotes(w http.ResponseWriter, r *http.Request) { |
| ToolsLabel: rastrillo.T(r, "slides.viewer.tools"), |
| } |
| shown := presentedFor(r, view, p) |
| - page.Counter, page.Current = shown.Counter, shown.Current |
| + page.Now, page.Counter, page.Current = shown.Now, shown.Counter, shown.Current |
| page.Next, page.HasNext, page.Notes = shown.Next, shown.HasNext, shown.Notes |
| if holder { |
| @@ -845,6 +847,13 @@ func clockWords(t time.Time) string { |
| // a hotel wifi. The projector at /p/{session} still gets the real |
| // rendering, because that one is the slide. |
| type presented struct { |
| + // Now is the 1-based slide these were rendered for — the number the |
| + // stream's events carry — and it goes on the page's script root as |
| + // data-slide, so static/present.js knows what it is already showing. |
| + // Without it the script took the page to be on slide 0, the first |
| + // event "moved" it, and the page reloaded itself on every load |
| + // (polish audit B3). |
| + Now int |
| Counter string |
| Current template.HTML |
| Next template.HTML |
| @@ -863,6 +872,7 @@ func presentedFor(r *http.Request, view *deck.Deck, p Presentation) presented { |
| } |
| index := clampSlide(p.Slide, count) |
| out := presented{ |
| + Now: index + 1, |
| Counter: rastrillo.Tf(r, "slides.present.progress", "n", index+1, "total", count), |
| Current: slideThumbImg(r, view, p, index), |
| } |
| @@ -965,7 +975,7 @@ func (a *app) remote(w http.ResponseWriter, r *http.Request) { |
| ToolsLabel: rastrillo.T(r, "slides.viewer.tools"), |
| } |
| shown := presentedFor(r, view, p) |
| - page.Counter, page.Current = shown.Counter, shown.Current |
| + page.Now, page.Counter, page.Current = shown.Now, shown.Counter, shown.Current |
| page.Next, page.HasNext, page.Notes = shown.Next, shown.HasNext, shown.Notes |
| render(w, "remote", page) |
| } |
diff --git a/internal/slides/static/present.js b/internal/slides/static/present.js| index 8d46682..5cc4509 100644 |
| --- a/internal/slides/static/present.js |
| +++ b/internal/slides/static/present.js |
| @@ -105,13 +105,6 @@ |
| // event this page understands and is left alone rather than fetched. |
| if (!(slide > 0) || slide === requested) return; |
| requested = slide; |
| - if (!stage || !fragmentHref) { |
| - // The presenter view and the remote show two slides and the |
| - // notes; re-rendering all that in here would be a second |
| - // renderer to keep in step with the Go one. |
| - window.location.reload(); |
| - return; |
| - } |
| var mine = ++newest; |
| var back = function () { |
| // Only this request's own failure rolls the record back, and |
| @@ -131,12 +124,54 @@ |
| .catch(back); |
| } |
| + // The pages with no stage to swap — the presenter view and the |
| + // remote — follow by reloading: they show two slides, the notes and |
| + // the blackout state, and re-rendering all that in here would be a |
| + // second renderer to keep in step with the Go one. Their root says |
| + // what they were rendered with (data-slide, data-blackout), and they |
| + // reload only when an event says something else. |
| + // |
| + // And at most once for any one state. A page that has just reloaded |
| + // for slide 3 and still says something else — a root missing its |
| + // data-slide, or a session pointing past a deck that has since got |
| + // shorter, which the server clamps — would otherwise reload again on |
| + // the stream's first event, and again after that, forever: the |
| + // presenter view once did exactly that about fifty times a second |
| + // (polish audit B3). The record is taken off at load, so it only |
| + // ever guards the load straight after the reload that wrote it. |
| + var renderedBlackout = root.getAttribute('data-blackout') === 'true'; |
| + var reloadKey = 'slides-present-reload:' + window.location.pathname; |
| + var reloadedFor = null; |
| + try { |
| + reloadedFor = window.sessionStorage.getItem(reloadKey); |
| + window.sessionStorage.removeItem(reloadKey); |
| + } catch (err) { /* no storage: see follow */ } |
| + |
| + function follow(state) { |
| + var slide = Number(state.slide); |
| + if (!(slide > 0)) return; |
| + var blackout = !!state.blackout; |
| + if (slide === displayed && blackout === renderedBlackout) return; |
| + var want = String(slide) + (blackout ? ':blackout' : ''); |
| + if (want === reloadedFor) return; |
| + try { |
| + window.sessionStorage.setItem(reloadKey, want); |
| + } catch (err) { |
| + // Nowhere to remember that this reload happened, so only reload |
| + // a page that at least knows which slide it is on. |
| + if (!displayed) return; |
| + } |
| + reloadedFor = want; |
| + window.location.reload(); |
| + } |
| + |
| // apply is the whole of what an event does. The state is complete — |
| // never a delta — so applying one is exactly right rather than |
| // approximately, and a page that missed some is right again on the |
| // next one. |
| function apply(state) { |
| if (state.ended) { window.location.reload(); return; } |
| + if (!stage || !fragmentHref) { follow(state); return; } |
| root.setAttribute('data-blackout', state.blackout ? 'true' : 'false'); |
| if (note) note.hidden = !state.blackout; |
| show(Number(state.slide)); |
diff --git a/internal/slides/static/slides.css b/internal/slides/static/slides.css| index 5d03c4e..17276eb 100644 |
| --- a/internal/slides/static/slides.css |
| +++ b/internal/slides/static/slides.css |
| @@ -682,12 +682,21 @@ |
| template that still carries an explicit multi-column track (only |
| `two-column` does, at 1fr 1fr) auto-places its items into that |
| track instead of stacking them — the region rule below undoes the |
| - named placement, this one undoes the columns underneath it. */ |
| + named placement, this one undoes the columns underneath it. |
| + |
| + The region rule has to be `[slides-region][data-region]`, not |
| + `[slides-region]`: the named placements above are (0,2,0), and a |
| + (0,1,0) rule here lost to them however late it came, so every |
| + region kept an area the collapsed grid no longer has and all of |
| + them landed in one implicit cell — the heading drawn over the |
| + body on every flow slide (polish audit B4). Equal specificity and |
| + later in the file is what wins; the browser drive |
| + TestBrowserPhoneStacksFlowRegions holds it. */ |
| [slides-slide][data-layout="flow"] > [slides-frame] { |
| grid-template-columns: 1fr; |
| grid-template-areas: none; |
| } |
| - [slides-region] { |
| + [slides-region][data-region] { |
| grid-area: auto; |
| } |
diff --git a/internal/slides/templates/present_notes.html b/internal/slides/templates/present_notes.html| index 221dd2b..d8d9469 100644 |
| --- a/internal/slides/templates/present_notes.html |
| +++ b/internal/slides/templates/present_notes.html |
| @@ -110,6 +110,7 @@ |
| A presenter view opened without the token watches and cannot |
| drive, which is exactly what the buttons above do too. */}} |
| <div slides-preview data-session="{{.Session}}" |
| + data-slide="{{.Now}}" |
| data-blackout="{{if .Blackout}}true{{else}}false{{end}}" |
| {{- if .Token}} data-remote-token="{{.Token}}"{{end}}> |
| <div> |
diff --git a/internal/slides/templates/remote.html b/internal/slides/templates/remote.html| index db74c99..8e984aa 100644 |
| --- a/internal/slides/templates/remote.html |
| +++ b/internal/slides/templates/remote.html |
| @@ -61,6 +61,7 @@ |
| {{template "page-header" dict "Title" .Title "Sub" .DeckTitle}} |
| <div slides-remote data-session="{{.Session}}" data-remote-token="{{.Controls.Token}}" |
| + data-slide="{{.Now}}" |
| data-blackout="{{if .Blackout}}true{{else}}false{{end}}"> |
| <div slides-remote-preview> |
| <div> |
diff --git a/internal/slidestest/browser_phone_test.go b/internal/slidestest/browser_phone_test.go| new file mode 100644 |
| index 0000000..fcf39fa |
| --- /dev/null |
| +++ b/internal/slidestest/browser_phone_test.go |
| @@ -0,0 +1,135 @@ |
| +//go:build browser |
| + |
| +// A flow slide on a phone reads top to bottom, one region under the |
| +// next. The container query in slides.css collapses every template to |
| +// one column; the failure this file was written for (polish audit B4, |
| +// 2026-09-23) was that collapse losing a specificity fight — the |
| +// phone's `[slides-region] { grid-area: auto }` (0,1,0) against the |
| +// template's `[slides-region][data-region="heading"] { grid-area: |
| +// heading }` (0,2,0) — so every region kept an area name the collapsed |
| +// grid no longer had, and all of them landed in the same cell: the |
| +// heading drawn over the body on every flow slide, in the viewer, on |
| +// share links and in the editor's Phone and Both views. |
| +package slidestest |
| + |
| +import ( |
| + "encoding/json" |
| + "strconv" |
| + "testing" |
| + |
| + "amadan.net/rastrillo/rastrillo/harness" |
| + "github.com/chromedp/cdproto/runtime" |
| + "github.com/chromedp/chromedp" |
| +) |
| + |
| +// stackedRegions is a JS expression that answers, for every flow |
| +// slide under root, the pairs of visible regions that overlap: an |
| +// empty list is the pass. Reading order is DOM order after the phone |
| +// layer's own `order`, so the check is on the boxes and not on which |
| +// comes first — two regions in one place is the bug whichever is on |
| +// top. |
| +func stackedRegions(root string) string { |
| + return `JSON.stringify((() => { |
| + const out = []; |
| + for (const s of document.querySelectorAll('` + root + ` [slides-slide][data-layout="flow"]')) { |
| + const rs = [...s.querySelectorAll(':scope > [slides-frame] > [slides-region]')] |
| + .map(e => ({name: e.dataset.region, r: e.getBoundingClientRect()})) |
| + .filter(x => x.r.width > 0 && x.r.height > 0); |
| + if (s.getBoundingClientRect().width > 600) out.push('slide wider than a phone: ' + s.getBoundingClientRect().width); |
| + for (let i = 0; i < rs.length; i++) for (let j = i + 1; j < rs.length; j++) { |
| + const a = rs[i].r, b = rs[j].r; |
| + const overlap = Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top); |
| + if (overlap > 0.5) out.push(s.dataset.template + ': ' + rs[i].name + ' [' + a.top.toFixed(1) + '–' + a.bottom.toFixed(1) + |
| + '] overlaps ' + rs[j].name + ' [' + b.top.toFixed(1) + '–' + b.bottom.toFixed(1) + ']'); |
| + } |
| + } |
| + return out; |
| + })())` |
| +} |
| + |
| +func noStackedRegions(t *testing.T, rig *harness.Rig, where, root string) { |
| + t.Helper() |
| + var raw string |
| + var flows int |
| + rig.Run( |
| + chromedp.Evaluate(`document.querySelectorAll('`+root+` [slides-slide][data-layout="flow"]').length`, &flows), |
| + chromedp.Evaluate(stackedRegions(root), &raw), |
| + ) |
| + var bad []string |
| + if err := json.Unmarshal([]byte(raw), &bad); err != nil { |
| + t.Fatalf("%s: read the browser's answer: %v\n%s", where, err, raw) |
| + } |
| + for _, b := range bad { |
| + t.Errorf("%s: %s", where, b) |
| + } |
| + if flows == 0 { |
| + t.Logf("%s: no flow slide on screen", where) |
| + } |
| +} |
| + |
| +// TestBrowserPhoneStacksFlowRegions walks the sample deck in the |
| +// viewer at 390px — every slide of it, so every template it carries — |
| +// and then opens the editor's Phone and Both views on a desktop |
| +// window, and requires that no two regions of a flow slide share any |
| +// height. |
| +func TestBrowserPhoneStacksFlowRegions(t *testing.T) { |
| + rig, mailer := newRig(t) |
| + browserSignIn(t, rig, mailer) |
| + |
| + var deck string |
| + rig.Run(chromedp.Evaluate(`(document.querySelector('a[href^="/d/"]')?.getAttribute('href') ?? '')`, &deck)) |
| + if !deckPath.MatchString(deck) { |
| + t.Fatalf("the deck list links no deck: %q", deck) |
| + } |
| + |
| + var count, flowsSeen int |
| + rig.Run( |
| + chromedp.EmulateViewport(390, 844, chromedp.EmulateMobile), |
| + chromedp.Navigate(rig.Origin+deck), |
| + chromedp.WaitVisible(`[slides-slide]`, chromedp.ByQuery), |
| + chromedp.Evaluate(`document.querySelectorAll('[slides-film] a').length`, &count), |
| + ) |
| + if count < 2 { |
| + t.Fatalf("the viewer lists %d slides; the sample deck has more", count) |
| + } |
| + for n := 1; n <= count; n++ { |
| + var flow int |
| + rig.Run( |
| + chromedp.Navigate(rig.Origin+deck+"?slide="+strconv.Itoa(n)), |
| + chromedp.WaitVisible(`[slides-slide]`, chromedp.ByQuery), |
| + chromedp.Evaluate(`document.fonts.ready.then(() => document.querySelectorAll('[slides-slide][data-layout="flow"]').length)`, &flow, |
| + func(p *runtime.EvaluateParams) *runtime.EvaluateParams { return p.WithAwaitPromise(true) }), |
| + ) |
| + flowsSeen += flow |
| + noStackedRegions(t, rig, "viewer at 390, slide "+strconv.Itoa(n), "body") |
| + if n == 1 { |
| + rig.Screen("body", "viewer at 390, slide 1") |
| + } |
| + } |
| + if flowsSeen < 3 { |
| + t.Errorf("the walk met only %d flow slides; the check needs real ones to mean anything", flowsSeen) |
| + } |
| + |
| + // The editor's Phone and Both views, on a desktop window: the phone |
| + // stage is a slide in a phone-sized container, so the same query |
| + // fires inside a 1440px page. |
| + rig.Run( |
| + chromedp.EmulateViewport(1440, 900), |
| + chromedp.Navigate(rig.Origin+deck+"/edit"), |
| + chromedp.WaitVisible(`[slides-editor]`, chromedp.ByQuery), |
| + waitFor(`document.querySelector('[slides-stage] [slides-slide]')`), |
| + chromedp.Click(`input[name="slides-view"][value="phone"]`, chromedp.ByQuery), |
| + waitFor(`document.querySelector('[slides-stage-pane]').dataset.view === 'phone'`), |
| + waitFor(`document.querySelector('[slides-stage] [slides-slide]')?.getBoundingClientRect().width <= 600`), |
| + ) |
| + rig.Screen("[slides-editor]", "editor phone view") |
| + noStackedRegions(t, rig, "editor Phone view", "[slides-stage]") |
| + |
| + rig.Run( |
| + chromedp.Click(`input[name="slides-view"][value="both"]`, chromedp.ByQuery), |
| + waitFor(`document.querySelector('[slides-stage-pane]').dataset.view === 'both'`), |
| + waitFor(`document.querySelector('[slides-stage-phone] [slides-slide]')`), |
| + ) |
| + rig.Screen("[slides-editor]", "editor both view") |
| + noStackedRegions(t, rig, "editor Both view, phone half", "[slides-stage-phone]") |
| +} |
diff --git a/internal/slidestest/browser_present_test.go b/internal/slidestest/browser_present_test.go| new file mode 100644 |
| index 0000000..13ed87b |
| --- /dev/null |
| +++ b/internal/slidestest/browser_present_test.go |
| @@ -0,0 +1,108 @@ |
| +//go:build browser |
| + |
| +// The presenting screens with their script on. The Go tests read the |
| +// markup; only a browser runs static/present.js against it, and the |
| +// failure this file was written for (polish audit B3, 2026-09-23) was |
| +// the script and the markup disagreeing: the presenter view and the |
| +// remote carried no data-slide, so the page believed it was on slide |
| +// 0, the stream's first event said slide 1, and the page reloaded — |
| +// and did the same on every load after, about fifty times a second. |
| +package slidestest |
| + |
| +import ( |
| + "regexp" |
| + "sync/atomic" |
| + "testing" |
| + "time" |
| + |
| + "github.com/chromedp/cdproto/page" |
| + "github.com/chromedp/chromedp" |
| + "github.com/chromedp/chromedp/kb" |
| +) |
| + |
| +var notesLocation = regexp.MustCompile(`^(/p/[23456789abcdefghjkmnpqrstuvwxyz]{10})/notes\?t=([A-Za-z0-9_-]{43})$`) |
| + |
| +// TestBrowserPresentingScreensHoldStill: the presenter view and the |
| +// phone remote each load once and then stay put while nothing |
| +// changes, and each reloads exactly once when the slide does move — |
| +// which is how those two pages follow a talk (present.js reloads them |
| +// rather than re-rendering two slides and the notes itself). |
| +func TestBrowserPresentingScreensHoldStill(t *testing.T) { |
| + rig, mailer := newRig(t) |
| + browserSignIn(t, rig, mailer) |
| + |
| + // Every top-level navigation the tab makes, reloads included. |
| + var loads atomic.Int64 |
| + chromedp.ListenTarget(rig.Context(), func(ev any) { |
| + if e, ok := ev.(*page.EventFrameNavigated); ok && e.Frame.ParentID == "" { |
| + loads.Add(1) |
| + } |
| + }) |
| + |
| + var deck string |
| + rig.Run(chromedp.Evaluate(`(document.querySelector('a[href^="/d/"]')?.getAttribute('href') ?? '')`, &deck)) |
| + if !deckPath.MatchString(deck) { |
| + t.Fatalf("the deck list links no deck: %q", deck) |
| + } |
| + |
| + var path string |
| + rig.Run( |
| + chromedp.Navigate(rig.Origin+deck), |
| + chromedp.Click(`form[action$="/present"] button`, chromedp.ByQuery), |
| + waitFor(`location.pathname.endsWith('/notes')`), |
| + chromedp.Evaluate(`location.pathname + location.search`, &path), |
| + ) |
| + m := notesLocation.FindStringSubmatch(path) |
| + if m == nil { |
| + t.Fatalf("Present landed on %q, want /p/{session}/notes?t={token}", path) |
| + } |
| + session, token := m[1], m[2] |
| + |
| + // holdsStill waits for the page to settle and the stream to have |
| + // said its piece (one event on connect), then counts loads over a |
| + // window long enough for the broken page to have reloaded hundreds |
| + // of times. |
| + holdsStill := func(name string) { |
| + t.Helper() |
| + rig.Run(chromedp.Sleep(1500 * time.Millisecond)) |
| + before := loads.Load() |
| + rig.Run(chromedp.Sleep(3 * time.Second)) |
| + if n := loads.Load() - before; n != 0 { |
| + t.Errorf("the %s loaded %d more times in 3s with nothing changing, want 0", name, n) |
| + } |
| + // And it holds still because it knows where it is, not only |
| + // because present.js refuses to reload twice for one slide: |
| + // the script's root names the slide the counter shows. |
| + var marked, counter string |
| + rig.Run( |
| + chromedp.Evaluate(`document.querySelector('[data-session]')?.getAttribute('data-slide') ?? 'missing'`, &marked), |
| + chromedp.Evaluate(`(document.querySelector('[slides-counter]')?.textContent ?? '').trim().split(' ')[0]`, &counter), |
| + ) |
| + if marked != counter { |
| + t.Errorf("the %s's script root says data-slide=%q; the counter shows slide %q", name, marked, counter) |
| + } |
| + } |
| + // movesOnce presses the right arrow — present.js posts `next` — and |
| + // the page must reload onto the new slide once, and only once. |
| + movesOnce := func(name, counter string) { |
| + t.Helper() |
| + before := loads.Load() |
| + rig.Run( |
| + chromedp.KeyEvent(kb.ArrowRight), |
| + waitFor(`document.querySelector('[slides-counter]')?.textContent.trim().startsWith('`+counter+` /')`), |
| + chromedp.Sleep(3*time.Second), |
| + ) |
| + if n := loads.Load() - before; n != 1 { |
| + t.Errorf("the %s loaded %d times after one slide change, want exactly 1", name, n) |
| + } |
| + } |
| + |
| + holdsStill("presenter view") |
| + rig.Screen("body", "presenter view") |
| + movesOnce("presenter view", "2") |
| + |
| + rig.Run(chromedp.Navigate(rig.Origin + session + "/remote?t=" + token)) |
| + holdsStill("remote") |
| + rig.Screen("body", "remote") |
| + movesOnce("remote", "3") |
| +} |
diff --git a/internal/slidestest/present_test.go b/internal/slidestest/present_test.go| index b482905..fd69a71 100644 |
| --- a/internal/slidestest/present_test.go |
| +++ b/internal/slidestest/present_test.go |
| @@ -567,3 +567,33 @@ func TestFollowOfferedOnlyWhileLive(t *testing.T) { |
| t.Errorf("following an ended session: status %d, want 303 back to the deck", rec.Code) |
| } |
| } |
| + |
| +// TestEveryPresentingPageSaysWhichSlideItShows: every page that loads |
| +// static/present.js puts the slide it was rendered for on the script's |
| +// root as data-slide, the same 1-based number the stream's events |
| +// carry. The presenter view and the remote once had none, so the |
| +// script took them to be on slide 0 and reloaded on every event — |
| +// the stream's first included — forever (polish audit B3). The |
| +// browser half is TestBrowserPresentingScreensHoldStill; this one is |
| +// in the plain suite so the gate holds it too. |
| +func TestEveryPresentingPageSaysWhichSlideItShows(t *testing.T) { |
| + a := newApp(t) |
| + cookies := signedIn(t, a, allowedAddress) |
| + path := sampleDeck(t, a, cookies) |
| + session, token := startPresenting(t, a, path, cookies) |
| + command(t, a, session, "next", token, "", nil) |
| + |
| + for _, page := range []string{ |
| + "/p/" + session + "?t=" + token, |
| + "/p/" + session + "/notes?t=" + token, |
| + "/p/" + session + "/remote?t=" + token, |
| + } { |
| + body := mustGet(t, a, page, http.StatusOK, cookies).Body.String() |
| + if !strings.Contains(body, `static/present`) { |
| + t.Errorf("%s no longer loads present.js; this test is about the pages that do", page) |
| + } |
| + if !strings.Contains(body, `data-slide="2"`) { |
| + t.Errorf("%s: the script root does not say data-slide=\"2\" after one next:\n%s", page, body) |
| + } |
| + } |
| +} |