diff options
| author | antoliny0919 <antoliny0919@gmail.com> | 2025-08-07 22:17:50 +0900 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-02-27 07:43:45 -0500 |
| commit | 187a789f99ecbc708de517c6b54d480b68ba59fe (patch) | |
| tree | a9ad3ba592bf6c65cb14b39110adbfbaa2825a51 /tests/admin_widgets/tests.py | |
| parent | d4ab33af061c13e290b6996756b2c72578891285 (diff) | |
Fixed #34643 -- Moved inputs beneath labels and errors in admin forms.
Thanks Sarah Boyce and Jacob Walls for reviews.
Co-authored-by: Hrushikesh Vaidya <hrushikeshrv@gmail.com>
Diffstat (limited to 'tests/admin_widgets/tests.py')
| -rw-r--r-- | tests/admin_widgets/tests.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index e0ae5b7747..5a8b29b83a 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -1203,6 +1203,41 @@ class DateTimePickerSeleniumTests(AdminWidgetSeleniumTestCase): # The right month and year are displayed. self.wait_for_text("#calendarin0 caption", expected_caption) + @override_settings(TIME_ZONE="Asia/Seoul") + def test_timezone_warning_message(self): + from selenium.webdriver.common.by import By + + self.admin_login(username="super", password="secret", login_url="/") + + self.selenium.get( + self.live_server_url + reverse("admin:admin_widgets_member_add") + ) + + datetime = self.selenium.find_element(By.CSS_SELECTOR, "p.datetime") + warnings = self.selenium.find_elements( + By.CSS_SELECTOR, "div.field-birthdate div.timezonewarning" + ) + self.assertEqual(len(warnings), 1) + + warning = warnings[0] + self.assertTrue(warning.is_displayed()) + next_element = warning.find_element(By.XPATH, "./following-sibling::*[1]") + # Warning messages are generally located just above the field block. + self.assertEqual(next_element, datetime) + + date = datetime.find_element(By.TAG_NAME, "input") + date.send_keys("invalid") + with self.wait_page_loaded(): + self.selenium.find_element(By.NAME, "_save").click() + + errors = self.selenium.find_element(By.ID, "id_birthdate_error") + warning = self.selenium.find_element( + By.CSS_SELECTOR, "div.help.timezonewarning" + ) + next_element = warning.find_element(By.XPATH, "./following-sibling::*[1]") + # warning message appears above the error message. + self.assertEqual(next_element, errors) + @requires_tz_support @override_settings(TIME_ZONE="Asia/Singapore") |
