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/rm30833.docent.yaml src/hg/utils/docent/tests/regress/rm30833.docent.yaml
new file mode 100644
index 00000000000..538ef30a9ed
--- /dev/null
+++ src/hg/utils/docent/tests/regress/rm30833.docent.yaml
@@ -0,0 +1,52 @@
+# #30833 -- two things about highlights, found by Jairo while QA'ing #30569.  In the
+# PNG/PDF output the ruler guidelines were drawn on top of the highlight instead of behind
+# it, and -- the half this asserts -- "if you highlight a region and then turn on
+# multi-region mode, the highlights all disappear".
+#
+# Galt's fix is 904babadd41, "Fixing issues with highlights in image/PDF, particularly
+# with multi-region".
+#
+# Only the second half is checked here.  The first lives in an image this suite cannot
+# reach: hgTracks draws the guidelines and the highlight into the PostScript itself
+# (drawHighlights() in hg/hgTracks/hgTracks.c), and what comes back from hgt.psOutput is a
+# page of links to a PDF, so there is nothing for rows:, text: or color: to read.  Say so
+# rather than leave a reader thinking the ticket is covered.
+#
+# In the HTML view a highlight is not in the image at all: hg/js/hgTracks.js
+# imageV2.drawHighlights() appends one <div class='highlightItem'> per highlight to the
+# body, positioned over the image.  So `has: .highlightItem` is the check, and it is the
+# whole signature of this bug -- the rows, the height and the items are identical with the
+# highlight and without it.
+#
+# Entering multi-region rewrites the highlight into virtual coordinates as it goes
+# (hg38#chr1#144874354#144875080#aaedff becomes hg38.multi:0-726#aaedff), which is the
+# conversion the ticket's disappearance was.  rm34250 is the same round trip in the other
+# direction.
+#
+# The highlight is set on the URL because that is the cart variable a drag-select writes,
+# and the two steps are separate navigations on purpose: the highlight has to be in the
+# cart BEFORE the mode changes, or the conversion this is about never happens.
+proof:
+  - "assertion-only 2026-09-12 -- written from the ticket long after the fix shipped"
+
+target: genome-test
+db: hg38
+position: chr1:144874000-144875500
+reset: true
+fast: true
+steps:
+  # A highlight over the UCSC Unusual Regions item at chr1:144,874,354-144,875,080.
+  - goto: "/cgi-bin/hgTracks?db=hg38&position=chr1%3A144874000-144875500&pix=1100&hideTracks=1&problematicSuper=show&problematic=pack&comments=pack&comments_sel=1&highlight=hg38%23chr1%23144874354%23144875080%23aaedff"
+  - expect:
+      rows: [ruler, comments]
+      exact: true
+      has: '.highlightItem'
+      noHas: '#hgTracksConfigMultiRegionPage.pressed'
+
+  # Turn multi-region on.  Nothing else changes, and the highlight has to survive.
+  - goto: "/cgi-bin/hgTracks?pix=1100&virtModeType=customUrl&virtWinFull=on&multiRegionsBedInput=chr1%20144874354%20144875080%0Achr1%2091386300%2091388400%0A"
+  - expect:
+      rows: [ruler, comments]
+      has:
+        - '#hgTracksConfigMultiRegionPage.pressed'
+        - '.highlightItem'