#32647: Select multiple action checkboxes with shift+mouseclick in django admin
-------------------------------------+-------------------------------------
Reporter: varicocelehealing | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 3.2
Severity: Release blocker | Resolution:
Keywords: Admin, Changelist, | Triage Stage: Accepted
Shift Click |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Carlton Gibson):
This diff to the tests covers what should be the correct behaviour:
{{{
diff --git a/js_tests/admin/actions.test.js
b/js_tests/admin/actions.test.js
index 0077dd6ff3..302254d1ab 100644
--- a/js_tests/admin/actions.test.js
+++ b/js_tests/admin/actions.test.js
@@ -15,9 +15,24 @@ QUnit.module('admin.actions', {
}
});
-QUnit.test('check', function(assert) {
+QUnit.test('check toggle all', function(assert) {
const $ = django.jQuery;
assert.notOk($('.action-select').is(':checked'));
$('#action-toggle').click();
assert.ok($('.action-select').is(':checked'));
});
+
+QUnit.test('check shift-toggle', function(assert) {
+ const checkboxes = document.querySelectorAll('tr input.action-
select');
+ checkboxes.forEach( c => assert.notOk(c.checked) );
+
+ // Check first and last checkbox, using shift to select those in-
between.
+ checkboxes[0].dispatchEvent(
+ new MouseEvent("click")
+ );
+ checkboxes[checkboxes.length - 1].dispatchEvent(
+ new MouseEvent("click", {shiftKey: true})
+ );
+
+ checkboxes.forEach( c => assert.ok(c.checked) );
+});
diff --git a/js_tests/tests.html b/js_tests/tests.html
index 61bc4ac102..b77599c4fa 100644
--- a/js_tests/tests.html
+++ b/js_tests/tests.html
@@ -22,7 +22,17 @@
</tr>
<tr>
<td class="action-checkbox">
- <input class="action-select" type="checkbox"
value="618">
+ <input class="action-select" type="checkbox"
value="1">
+ </td>
+ </tr>
+ <tr>
+ <td class="action-checkbox">
+ <input class="action-select" type="checkbox"
value="2">
+ </td>
+ </tr>
+ <tr>
+ <td class="action-checkbox">
+ <input class="action-select" type="checkbox"
value="3">
</td>
</tr>
</table>
}}}
We have three checkboxes, check the first and last (using shift), and
expect them all to be checked.
--
Ticket URL: <https://code.djangoproject.com/ticket/32647#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/075.f84dbd27a8feaa45887a9d7199850f72%40djangoproject.com.