Skip to content

Commit 9dfeb30

Browse files
committed
Fix section checkboxes when frozen
1 parent 132b83d commit 9dfeb30

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/tree-multiselect/tree.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,7 @@ Tree.prototype.redrawSectionCheckboxes = function ($section) {
245245
if (returnVal) {
246246
let $childCheckboxes = $section.find('> div.item > input[type=checkbox]');
247247
for (let ii = 0; ii < $childCheckboxes.length; ++ii) {
248-
if ($childCheckboxes[ii].disabled) {
249-
// do nothing
250-
} else if ($childCheckboxes[ii].checked) {
248+
if ($childCheckboxes[ii].checked) {
251249
returnVal &= ~0b10;
252250
} else {
253251
returnVal &= ~0b01;

test/integration/options.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,21 @@ describe('Options', () => {
146146
assert.equal(removeSpans.length, 0);
147147
});
148148

149+
it('section checkboxes are indetermine if some children are selected', () => {
150+
$("select").append("<option value='one' data-section='test'>One</option>");
151+
$("select").append("<option value='two' data-section='test' selected='selected'>Two</option>");
152+
var options = {
153+
freeze: true
154+
};
155+
$("select").treeMultiselect(options);
156+
157+
var $sectionCheckbox = Common.sectionCheckbox({text: 'test'});
158+
assert.equal($sectionCheckbox.length, 1);
159+
var checkbox = $sectionCheckbox[0];
160+
assert(checkbox.indeterminate);
161+
assert(!checkbox.checked);
162+
});
163+
149164
it('applies only to one tree and not another', () => {
150165
$("select").append("<option value='one' data-section='test'>One</option>");
151166
$("select").treeMultiselect();

0 commit comments

Comments
 (0)