fe79fa58f3040e69e5ac3fa38037674b007d2e61
braney
  Sat Sep 12 13:47:50 2026 -0700
docent: ten regression tests for multi-region view, refs #38252

One script per Closed multi-region ticket, asserting the behavior the ticket
says is correct, on genome-test.  Before these the only script here that
entered multi-region at all was rm35580, which uses singleAltHaplo to reach a
different bug.

Between them they cover the four modes, the dialog, the custom-region BED
reader, hideEmptySubtracks across windows, and highlights in both directions
across the mode change:

rm22144  the alt-haplotype input is in the dialog, and hgSuggest
type=altOrPatch resolves the ticket's own mhc, apd and NT_187643
rm23922  the Multi-region and Reverse buttons carry class='pressed' while
their mode is on, and lose it on exit
rm26772  a zero-length BED line names itself instead of aborting with
"Window out of range"
rm27855  hg19 GTEx Gene in singleAltHaplo on chr6_cox_hap2 renders and
clicks through instead of freezing
rm29452  the dialog's exit radio is enabled and checked from a normal view,
and selectable from inside exon view (#34776's half, the missing
hgTracks.virtModeType in the dialog's JSON)
rm29787  custom regions in UCSC chrom names work on hs1
rm30833  a highlight survives turning multi-region on
rm34250  a highlight made in multi-region survives exiting, back in chr1
coordinates
rm35472  hideEmptySubtracks over two windows keeps both subtracks that have
items in one of them, and still hides the one with items in neither
rm37175  exon view keeps the last searched transcript

All ten are assertion-only: every fix shipped long ago.  make test is 47 of 47
green, 7m34s.

README.txt gains the two things they cost a red run each.  Never assert on a
title attribute: hgTracks' tooltip code moves it into data-tooltip once the
page's JavaScript has run.  And multi-region is fully reachable from a goto:
URL -- virtModeType, multiRegionsBedInput, singleAltHaploId, virtWinFull,
<composite>.hideEmptySubtracks -- but the dialog is not, because what it
decides is in JavaScript.

Three candidates were rejected and should not be picked again: #32544 was
closed by deferring to #37256 and is not fixed, #27891 needs a track with a
trackDb multiRegionsBedUrl and /gbdb/hg38/covidMuts/covidMuts.regions.bed does
not exist, and #24055's gesture is an ajax visibility change that no Docent
verb makes.

diff --git src/hg/utils/docent/tests/regress/README.txt src/hg/utils/docent/tests/regress/README.txt
index e8649af87a1..5ad966e8844 100644
--- src/hg/utils/docent/tests/regress/README.txt
+++ src/hg/utils/docent/tests/regress/README.txt
@@ -105,15 +105,47 @@
 That is also why the ticket was filed saying there was no warning at all.
 
 Two things fall out of it that apply to any script here:
 
   * `rows:` cannot express "this track drew its items". The broken build draws the row.
     `color:` with `is:` on the item color and `not: "240,240,180"` can, and a failure
     prints what each row really came out.
   * A drawn item that cannot be clicked through is half a bug. rm38310 clicks its item
     and asserts the item's POSITION on the hgc page, because the aborted hgc page carries
     the track's longLabel twice in its own header and a text: check on that alone passes
     on it.
 
 Measured both ways on 2026-09-09: the whole directory was run against the #38310 ticket
 sandbox twice, once with the patched hgTracks and hgc and once with unpatched controls
 built from the same tree. Thirty-seven scripts, identical verdicts, except this one.
+
+Ten scripts for multi-region view, and the two traps they hit
+--------------------------------------------------------------
+
+rm22144, rm23922, rm26772, rm27855, rm29452, rm29787, rm30833, rm34250, rm35472 and
+rm37175 are one batch, written 2026-09-12, and between them they cover the four modes
+(exon, custom regions, alt haplotype, exit), the dialog, the custom-region BED reader,
+hideEmptySubtracks across windows and highlights in both directions across the mode
+change. Before them the only script here that entered multi-region at all was rm35580,
+which uses singleAltHaplo to reach a different bug.
+
+Two things learned writing them, both of which cost a red run first:
+
+**Never assert on a `title` attribute.** hgTracks' own tooltip code moves a title into
+`data-tooltip` once the page's JavaScript has run, so `area[title="chr1:10001-11000"]`
+matches nothing in the live DOM even though the server sent exactly that. The server
+writes both attributes on a map box; assert `data-tooltip`. The same applies to the
+buttons, where the title changes with the mode and would otherwise be a second, free
+assertion -- it is not available.
+
+**Multi-region is reachable from the URL, and the dialog is not.** `virtModeType=`,
+`multiRegionsBedInput=` (the textarea's own cart variable, newlines as %0A),
+`singleAltHaploId=`, `virtWinFull=on` and `<composite>.hideEmptySubtracks=on` all work on
+a `goto:`, which is how nine of the ten set their state -- Docent has no verb that types
+into an arbitrary field, so the textarea and the alt-haplotype input cannot be filled.
+What still needs the real dialog is anything the page's JavaScript decides: rm29452's
+disabled radio and its status line are invisible to curl, because the server sends the
+same HTML on a build with the bug and a build without it.
+
+`virtWinFull=on` is worth knowing for a third reason: without it a region change lands
+zoomed in on one region, so a second region is off screen and a script cannot tell a
+region that failed to resolve from one that is merely not in view.