Order hostnames first in new entry form

This commit is contained in:
Philip Henning 2026-09-04 18:43:39 +02:00
parent f9d09e7fad
commit 703e85fb1b
2 changed files with 23 additions and 29 deletions

View file

@ -193,15 +193,15 @@ class TestAddEntryModalRadioButtonLogic:
# Mock the query_one method for sections and inputs
mock_ip_section = Mock()
mock_dns_section = Mock()
mock_ip_input = Mock(spec=Input)
mock_hostname_input = Mock(spec=Input)
def mock_query_one(selector, widget_type=None):
if selector == "#ip-section":
return mock_ip_section
elif selector == "#dns-section":
return mock_dns_section
elif selector == "#ip-address-input":
return mock_ip_input
elif selector == "#hostnames-input":
return mock_hostname_input
return Mock()
self.modal.query_one = Mock(side_effect=mock_query_one)
@ -225,22 +225,22 @@ class TestAddEntryModalRadioButtonLogic:
# Verify IP section is shown and DNS section is hidden
mock_ip_section.remove_class.assert_called_with("hidden")
mock_dns_section.add_class.assert_called_with("hidden")
mock_ip_input.focus.assert_called_once()
mock_hostname_input.focus.assert_called_once()
def test_radio_button_change_to_dns_entry(self):
"""Test radio button change to DNS entry mode."""
# Mock the query_one method for sections and inputs
mock_ip_section = Mock()
mock_dns_section = Mock()
mock_dns_input = Mock(spec=Input)
mock_hostname_input = Mock(spec=Input)
def mock_query_one(selector, widget_type=None):
if selector == "#ip-section":
return mock_ip_section
elif selector == "#dns-section":
return mock_dns_section
elif selector == "#dns-name-input":
return mock_dns_input
elif selector == "#hostnames-input":
return mock_hostname_input
return Mock()
self.modal.query_one = Mock(side_effect=mock_query_one)
@ -264,7 +264,7 @@ class TestAddEntryModalRadioButtonLogic:
# Verify DNS section is shown and IP section is hidden
mock_ip_section.add_class.assert_called_with("hidden")
mock_dns_section.remove_class.assert_called_with("hidden")
mock_dns_input.focus.assert_called_once()
mock_hostname_input.focus.assert_called_once()
class TestAddEntryModalSaveLogic: