|
108 | 108 |
|
109 | 109 | /* Style for h2 checkboxes */ |
110 | 110 | #tests h2 input[type="checkbox"] { |
111 | | - margin-right: 10px; |
| 111 | + margin-right: 18px; |
112 | 112 | transform: scale(1.2); |
113 | 113 | } |
114 | 114 |
|
|
375 | 375 | runTests(); |
376 | 376 | }); |
377 | 377 |
|
378 | | - $('#unselect-all').click(() => { |
379 | | - $('.test-checkbox').prop('checked', false); |
380 | | - $('#fsTests-group, #kvTests-group, #aiTests-group').prop('checked', false).trigger('change'); |
| 378 | + // Master checkbox functionality |
| 379 | + $('#master-checkbox').change(function() { |
| 380 | + const isChecked = $(this).prop('checked'); |
| 381 | + $('.test-checkbox').prop('checked', isChecked); |
| 382 | + $('#fsTests-group, #kvTests-group, #aiTests-group').prop('checked', isChecked); |
| 383 | + }); |
| 384 | + |
| 385 | + // Function to update master checkbox state |
| 386 | + function updateMasterCheckboxState() { |
| 387 | + const totalCheckboxes = $('.test-checkbox').length; |
| 388 | + const checkedCheckboxes = $('.test-checkbox:checked').length; |
| 389 | + |
| 390 | + if (checkedCheckboxes === 0) { |
| 391 | + $('#master-checkbox').prop('checked', false).prop('indeterminate', false); |
| 392 | + } else if (checkedCheckboxes === totalCheckboxes) { |
| 393 | + $('#master-checkbox').prop('checked', true).prop('indeterminate', false); |
| 394 | + } else { |
| 395 | + $('#master-checkbox').prop('checked', false).prop('indeterminate', true); |
| 396 | + } |
| 397 | + } |
| 398 | + |
| 399 | + // Update master checkbox state when individual checkboxes change |
| 400 | + $(document).on('change', '.test-checkbox', function() { |
| 401 | + updateMasterCheckboxState(); |
381 | 402 | }); |
382 | 403 |
|
383 | | - $('#select-all').click(() => { |
384 | | - $('.test-checkbox').prop('checked', true); |
385 | | - $('#fsTests-group, #kvTests-group, #aiTests-group').prop('checked', true).trigger('change'); |
| 404 | + // Update master checkbox state when group checkboxes change |
| 405 | + $('#fsTests-group, #kvTests-group, #aiTests-group').change(function() { |
| 406 | + updateMasterCheckboxState(); |
386 | 407 | }); |
387 | 408 |
|
388 | 409 | }); |
|
392 | 413 | <body> |
393 | 414 |
|
394 | 415 | <nav style="position: fixed; top: 0; width: 100%; background: #EEE; left: 0; padding-left: 10px;"> |
| 416 | + <label style="margin-left: 8px; margin-right: 10px; cursor: pointer; display: inline-flex; align-items: center;"> |
| 417 | + <input type="checkbox" id="master-checkbox" checked style="margin-right: 5px; transform: scale(1.2);"> |
| 418 | + </label> |
395 | 419 | <button id="run-tests">Run Tests</button> |
396 | | - <span id="select-all">Select All</span> |
397 | | - <span id="unselect-all">Unselect All</span> |
398 | 420 | </nav> |
399 | 421 | <div id="tests"></div> |
400 | 422 | </body> |
|
0 commit comments