summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-04-23 18:50:49 +0000
committerDries Buytaert <dries@buytaert.net>2008-04-23 18:50:49 +0000
commit63406e5268e564acb83078eb3beb1abdfefee0ec (patch)
tree9474ddfb0682c6e17ae35fd61bb2c45ef14fab55
parente19dfc75c9ca576a984d44b6ec3195b3ada38f48 (diff)
downloadbrdo-63406e5268e564acb83078eb3beb1abdfefee0ec.tar.gz
brdo-63406e5268e564acb83078eb3beb1abdfefee0ec.tar.bz2
- Patch #250056 by dmitrig01: if all the checkboxes in a checkbox group are checked on page load, the check all box isn't checked, which is should be (because all sub-boxes are checked).
-rw-r--r--modules/simpletest/simpletest.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/simpletest/simpletest.js b/modules/simpletest/simpletest.js
index db9352a24..41d7494ea 100644
--- a/modules/simpletest/simpletest.js
+++ b/modules/simpletest/simpletest.js
@@ -29,7 +29,7 @@ Drupal.behaviors.simpleTestMenuCollapse = function() {
}
Drupal.behaviors.simpleTestSelectAll = function() {
$('td.simpletest-select-all').each(function() {
- var checkboxes = Drupal.settings.simpleTest['simpletest-test-group-'+ $(this).attr('id')].testNames,
+ var checkboxes = Drupal.settings.simpleTest['simpletest-test-group-'+ $(this).attr('id')].testNames, totalCheckboxes = 0,
checkbox = $('<input type="checkbox" class="form-checkbox" id="'+ $(this).attr('id') +'-select-all" />').change(function() {
var checked = !!($(this).attr('checked'));
for (var i = 0; i < checkboxes.length; i++) {
@@ -39,7 +39,7 @@ Drupal.behaviors.simpleTestSelectAll = function() {
}).data('simpletest-checked-tests', 0);
var self = $(this);
for (var i = 0; i < checkboxes.length; i++) {
- $('#'+ checkboxes[i]).change(function() {
+ if ($('#'+ checkboxes[i]).change(function() {
if (checkbox.attr('checked') == 'checked') {
checkbox.attr('checked', '');
}
@@ -51,7 +51,12 @@ Drupal.behaviors.simpleTestSelectAll = function() {
else {
checkbox.attr('checked', '');
}
- });
+ }).attr('checked') == 'checked') {
+ totalCheckboxes++;
+ }
+ }
+ if (totalCheckboxes == checkboxes.length) {
+ $(checkbox).attr('checked', 'checked');
}
$(this).append(checkbox);
});