Skip to content

Commit f23216b

Browse files
committed
partially selected checkboxes should are reflected in the heading master checkbox
1 parent f06c13a commit f23216b

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/puter-js/test/run.html

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,40 @@
257257
$(document).on('change', '.fsTests-checkbox', function() {
258258
const totalFsTests = $('.fsTests-checkbox').length;
259259
const checkedFsTests = $('.fsTests-checkbox:checked').length;
260-
$('#fsTests-group').prop('checked', checkedFsTests === totalFsTests);
260+
261+
if (checkedFsTests === 0) {
262+
$('#fsTests-group').prop('checked', false).prop('indeterminate', false);
263+
} else if (checkedFsTests === totalFsTests) {
264+
$('#fsTests-group').prop('checked', true).prop('indeterminate', false);
265+
} else {
266+
$('#fsTests-group').prop('checked', false).prop('indeterminate', true);
267+
}
261268
});
262269

263270
$(document).on('change', '.kvTests-checkbox', function() {
264271
const totalKvTests = $('.kvTests-checkbox').length;
265272
const checkedKvTests = $('.kvTests-checkbox:checked').length;
266-
$('#kvTests-group').prop('checked', checkedKvTests === totalKvTests);
273+
274+
if (checkedKvTests === 0) {
275+
$('#kvTests-group').prop('checked', false).prop('indeterminate', false);
276+
} else if (checkedKvTests === totalKvTests) {
277+
$('#kvTests-group').prop('checked', true).prop('indeterminate', false);
278+
} else {
279+
$('#kvTests-group').prop('checked', false).prop('indeterminate', true);
280+
}
267281
});
268282

269283
$(document).on('change', '.aiTests-checkbox', function() {
270284
const totalAiTests = $('.aiTests-checkbox').length;
271285
const checkedAiTests = $('.aiTests-checkbox:checked').length;
272-
$('#aiTests-group').prop('checked', checkedAiTests === totalAiTests);
286+
287+
if (checkedAiTests === 0) {
288+
$('#aiTests-group').prop('checked', false).prop('indeterminate', false);
289+
} else if (checkedAiTests === totalAiTests) {
290+
$('#aiTests-group').prop('checked', true).prop('indeterminate', false);
291+
} else {
292+
$('#aiTests-group').prop('checked', false).prop('indeterminate', true);
293+
}
273294
});
274295

275296
window.assert = function(condition, message) {

0 commit comments

Comments
 (0)