From 63406e5268e564acb83078eb3beb1abdfefee0ec Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 23 Apr 2008 18:50:49 +0000 Subject: - 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). --- modules/simpletest/simpletest.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'modules') 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 = $('').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); }); -- cgit v1.2.3