- Patch #1684868 by nod_: JSHint simpletest.

8.0.x
Dries 2012-07-15 06:05:40 -07:00
parent ac981fcc10
commit 15b2390e41
1 changed files with 9 additions and 13 deletions

View File

@ -69,31 +69,27 @@ Drupal.behaviors.simpleTestSelectAll = {
// Each time a single-test checkbox is checked or unchecked, make sure
// that the associated group checkbox gets the right state too.
var updateGroupCheckbox = function () {
function updateGroupCheckbox() {
var checkedTests = 0;
for (var i = 0; i < testCheckboxes.length; i++) {
$('#' + testCheckboxes[i]).each(function () {
if (($(this).attr('checked'))) {
checkedTests++;
}
});
if ($('#' + testCheckboxes[i]).prop('checked')) {
checkedTests++;
}
}
$(groupCheckbox).attr('checked', (checkedTests === testCheckboxes.length));
};
$(groupCheckbox).prop('checked', (checkedTests === testCheckboxes.length));
}
// Have the single-test checkboxes follow the group checkbox.
groupCheckbox.change(function () {
var checked = !!($(this).attr('checked'));
var checked = $(this).prop('checked');
for (var i = 0; i < testCheckboxes.length; i++) {
$('#' + testCheckboxes[i]).attr('checked', checked);
$('#' + testCheckboxes[i]).prop('checked', checked);
}
});
// Have the group checkbox follow the single-test checkboxes.
for (var i = 0; i < testCheckboxes.length; i++) {
$('#' + testCheckboxes[i]).change(function () {
updateGroupCheckbox();
});
$('#' + testCheckboxes[i]).change(updateGroupCheckbox);
}
// Initialize status for the group checkbox correctly.