summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2021-04-15 17:15:28 +0200
committerCarlton Gibson <carlton.gibson@noumenal.es>2021-04-21 08:31:06 +0200
commit5c73fbb6a93ee214678f02ba4027f18dff49337b (patch)
tree9eba97cddf7490fde7068f4245fcbc33eac49265 /tests
parent54e94640ace261b14cf8cdb1fae3dc6f068a5f87 (diff)
Fixed #32647 -- Restored multi-row select with shift-modifier in admin changelist.
Regression in 30e59705fc3e3e9e8370b965af794ad6173bf92b.
Diffstat (limited to 'tests')
-rw-r--r--tests/admin_changelist/tests.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py
index 28acc401c1..8da1c2f799 100644
--- a/tests/admin_changelist/tests.py
+++ b/tests/admin_changelist/tests.py
@@ -1381,6 +1381,28 @@ class SeleniumTests(AdminSeleniumTestCase):
self.assertIs(all_selector.get_property('checked'), False)
self.assertEqual(row.get_attribute('class'), '')
+ def test_modifier_allows_multiple_section(self):
+ """
+ Selecting a row and then selecting another row whilst holding shift
+ should select all rows in-between.
+ """
+ from selenium.webdriver.common.action_chains import ActionChains
+ from selenium.webdriver.common.keys import Keys
+
+ Parent.objects.bulk_create([Parent(name='parent%d' % i) for i in range(5)])
+ self.admin_login(username='super', password='secret')
+ self.selenium.get(self.live_server_url + reverse('admin:admin_changelist_parent_changelist'))
+ checkboxes = self.selenium.find_elements_by_css_selector('tr input.action-select')
+ self.assertEqual(len(checkboxes), 5)
+ for c in checkboxes:
+ self.assertIs(c.get_property('checked'), False)
+ # Check first row. Hold-shift and check next-to-last row.
+ checkboxes[0].click()
+ ActionChains(self.selenium).key_down(Keys.SHIFT).click(checkboxes[-2]).key_up(Keys.SHIFT).perform()
+ for c in checkboxes[:-2]:
+ self.assertIs(c.get_property('checked'), True)
+ self.assertIs(checkboxes[-1].get_property('checked'), False)
+
def test_select_all_across_pages(self):
Parent.objects.bulk_create([Parent(name='parent%d' % i) for i in range(101)])
self.admin_login(username='super', password='secret')