Extract _combobox_shell from SearchSelect

Pull the domain-agnostic combobox skeleton (pills region, search box, options
panel with its no-results node, outer container) into a private _combobox_shell
helper. SearchSelect now builds its form-specific pills and option rows and
delegates assembly to the shell. Rendered markup is byte-identical; a structural
test guards the fixed region order so future builders (e.g. a filter variant)
can share the shell without drift.

https://claude.ai/code/session_01XzhXvMvw42CQGc9kmin3GS
This commit is contained in:
Claude
2026-06-07 21:58:43 +00:00
committed by Lukáš Kucharczyk
parent 547894d8d0
commit e2cbd4a9f4
2 changed files with 67 additions and 22 deletions
+14
View File
@@ -106,6 +106,20 @@ class SearchSelectComponentTest(unittest.TestCase):
)
self.assertNotIn('data-ss-option=""', html)
def test_shell_region_order_pills_search_options(self):
# The shared shell assembles the three regions in a fixed order; option
# rows precede the trailing no-results node inside the options panel.
html = SearchSelect(name="t", options=[("1", "One")])
pills = html.index("data-ss-pills")
search = html.index("data-ss-search")
options = html.index("data-ss-options")
option_row = html.index('data-ss-option=""')
no_results = html.index("data-ss-no-results")
self.assertLess(pills, search)
self.assertLess(search, options)
self.assertLess(options, option_row)
self.assertLess(option_row, no_results)
class SearchLabelTest(django.test.TestCase):
@classmethod