summaryrefslogtreecommitdiff
path: root/tests/admin_views
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-06-25 21:59:33 -0700
committerGitHub <noreply@github.com>2020-06-26 06:59:33 +0200
commitfeb658199373c5f61d02bc78516c8386c4821d6a (patch)
tree12ca35654c266f6c8986f0891f8fca32cfba7ad6 /tests/admin_views
parentf3e5fba7c5d6fbfa8d8d0694eb4ab311f874de5d (diff)
Fixed the centering of the "Log in" button on admin login page.
Previously, the button's container had a padding of 9.4em which was approximately center but not precisely. Now, the container uses 'align:text-center' to let the browser center the button.
Diffstat (limited to 'tests/admin_views')
-rw-r--r--tests/admin_views/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index a3a60ba181..caa1d80164 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -4460,6 +4460,17 @@ class SeleniumTests(AdminSeleniumTestCase):
self.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
self.p1 = PrePopulatedPost.objects.create(title='A Long Title', published=True, slug='a-long-title')
+ def test_login_button_centered(self):
+ self.selenium.get(self.live_server_url + reverse('admin:login'))
+ button = self.selenium.find_element_by_css_selector('.submit-row input')
+ offset_left = button.get_property('offsetLeft')
+ offset_right = (
+ button.get_property('offsetParent').get_property('offsetWidth') -
+ (offset_left + button.get_property('offsetWidth'))
+ )
+ # Use assertAlmostEqual to avoid pixel rounding errors.
+ self.assertAlmostEqual(offset_left, offset_right, delta=3)
+
def test_prepopulated_fields(self):
"""
The JavaScript-automated prepopulated fields work with the main form