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/rm37175.docent.yaml src/hg/utils/docent/tests/regress/rm37175.docent.yaml
new file mode 100644
index 00000000000..1ec9e2dc483
--- /dev/null
+++ src/hg/utils/docent/tests/regress/rm37175.docent.yaml
@@ -0,0 +1,55 @@
+# #37175 -- a transcript the user had just searched for showed in the default view and
+# then vanished in exon view.  Brian's change had made hgFind's last match a whitelist:
+# an item named in the cart's hgFind.matches is drawn even when the track's own filters
+# would drop it.  The exon-view code builds its regions from the same gene table with its
+# own copy of those filters, and it had no whitelist, so the searched transcript was
+# filtered out of the region list and the two modes disagreed for no visible reason.
+#
+# Galt added the whitelist to that reader in 492f1437811 (2026-02-27); bcffaeb1cb9
+# corrected the condition after code review, so the shipped test is
+#
+#     if (gene && (!hgFindMatches || !hashLookup(hgFindMatches, gene->name)))
+#         { ... the four filters ... }
+#
+# in initVirtRegionsFromEMGeneTableExons(), hg/hgTracks/hgTracks.c.
+#
+# ENST00000488409.1 is a knownGene transcript whose knownAttrs transcriptClass is
+# 'pseudo', and knownGene.show.pseudo is off by default, so it is one of the transcripts
+# that reader drops.  The two steps are the same URL with and without the whitelist, so
+# nothing but hgFind.matches differs between them and the item appears in the second.
+#
+# hgFind.matches is set here on the URL rather than by searching for the accession,
+# because a search is a whole other CGI's behaviour and this is not a test of hgFind.  It
+# is the cart variable hgFind writes and the one createHgFindMatchHash() reads
+# (hg/hgTracks/simpleTracks.c).
+#
+# There is no expect: check for "this item was drawn", so the item's own map box is named
+# with has:/noHas:.  README.txt says to reach for a selector last, and this is the case it
+# leaves: rows: cannot see one item, the row is drawn either way, and the two views have
+# the same height and the same tooltips.
+proof:
+  - "assertion-only 2026-09-12 -- written from the ticket and from 492f1437811, after the fix shipped"
+
+target: genome-test
+db: hg38
+position: chr17:7754000-7755500
+reset: true
+fast: true
+steps:
+  # Exon view, no search.  The pseudogene is filtered out of the region list, so it is
+  # nowhere in the image map.
+  - goto: "/cgi-bin/hgTracks?db=hg38&position=chr17%3A7754000-7755500&pix=1100&hideTracks=1&knownGene=pack&virtModeType=exonMostly"
+  - expect:
+      rows: [ruler, knownGene]
+      exact: true
+      has: '#hgTracksConfigMultiRegionPage.pressed'
+      noHas: 'area[href*="hgg_gene=ENST00000488409.1"]'
+
+  # The same view, with the pseudogene as the last search.  It is drawn now.
+  - goto: "/cgi-bin/hgTracks?db=hg38&position=chr17%3A7754000-7755500&pix=1100&hideTracks=1&knownGene=pack&virtModeType=exonMostly&hgFind.matches=ENST00000488409.1"
+  - expect:
+      rows: [ruler, knownGene]
+      exact: true
+      has:
+        - '#hgTracksConfigMultiRegionPage.pressed'
+        - 'area[href*="hgg_gene=ENST00000488409.1"]'