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/rm22144.docent.yaml src/hg/utils/docent/tests/regress/rm22144.docent.yaml
new file mode 100644
index 00000000000..f18966c12ff
--- /dev/null
+++ src/hg/utils/docent/tests/regress/rm22144.docent.yaml
@@ -0,0 +1,56 @@
+# #22144 -- the multi-region dialog's fourth mode, "show one alternate haplotype or fix
+# patch placed on its chromosome", takes a sequence NAME, and before this ticket the user
+# had to already know UCSC's name for it.  A reader who has the alt from NCBI knows it as
+# HSCHR19KIR_LUCE_A_HAP_CTG3_1 or as RefSeq NT_187643.1, and neither string is anything
+# the input would accept.  The ask was an autocomplete over chromAlias, so that "mhc" or
+# "apd" or the RefSeq accession finds chr6_GL000250v2_alt for them.
+#
+# Angie's fix is bffbb000a3d (2018-09-24), "Added a new mode to hgSuggest: altOrPatch, to
+# match alt haplo or fix patch sequence names.  Use it in hgTracks' multi-region dialog."
+# Its commit message refs #18854, the ticket this one was split out of, not #22144.
+#
+# The dialog wires the input to hgSuggest in popUpHgt, hg/js/hgTracks.js:
+#
+#     autocompleteCat.init($('#singleAltHaploId'),
+#         { baseUrl: 'hgSuggest?db=' + getDb() + '&type=altOrPatch&prefix=', ... });
+#
+# so the behaviour splits in two, and this asserts both halves separately.  Docent has no
+# verb that types into an arbitrary field, so the menu itself cannot be raised here; what
+# CAN be asserted is that the input is in the dialog and that the CGI behind it answers
+# the ticket's own three search terms with the UCSC names.  Each hgSuggest answer is
+# checked for the exact name AND for the alias it was found through, because a server
+# that lost the chromAlias join would still return every alt whose UCSC name starts with
+# the prefix -- and for "mhc", "apd" and "NT_187643" that is nothing at all, so a bare
+# "the reply is not empty" check is what this must not be.
+proof:
+  - "assertion-only 2026-09-12 -- written from the ticket long after the fix shipped"
+
+target: genome-test
+db: hg38
+position: chr17:43044295-43125364
+reset: true
+fast: true
+steps:
+  - go: chr17:43044295-43125364
+  - click: '#hgTracksConfigMultiRegionPage'
+  - wait: '#multiRegionsBedInput'
+
+  # The mode and its input are there at all.  hg38 has alts, so config.c draws this
+  # radio; on an assembly without them there is no fourth row and no input.
+  - expect:
+      has:
+        - '#hgTracksDialog:visible'
+        - '#singleAltHaploId'
+      text: "placed on its chromosome"
+
+  # The CGI the input asks.  A group name that is not a chrom name at all.
+  - goto: "/cgi-bin/hgSuggest?db=hg38&type=altOrPatch&prefix=mhc"
+  - expect: {text: "chr6_GL000251v2_alt (HSCHR6_MHC_COX_CTG1)"}
+
+  # ... one haplotype of that group.
+  - goto: "/cgi-bin/hgSuggest?db=hg38&type=altOrPatch&prefix=apd"
+  - expect: {text: "chr6_GL000250v2_alt (HSCHR6_MHC_APD_CTG1)"}
+
+  # ... and the RefSeq accession the ticket quoted.
+  - goto: "/cgi-bin/hgSuggest?db=hg38&type=altOrPatch&prefix=NT_187643"
+  - expect: {text: "chr19_KI270889v1_alt (NT_187643.1)"}