Skip to content
Snippets Groups Projects
Commit 15b2390e authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #1684868 by nod_: JSHint simpletest.

parent ac981fcc
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment