Skip to content

Commit 7ac5e6f

Browse files
committed
Fixed incorrect highlighting of options that were activated, removed and then re-added in "multiple" mode
Fixes issues #1212 and #1216.
1 parent 5f3f3c1 commit 7ac5e6f

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<!-- Feel free to put either your handle and/or full name, according to
22
your privacy needs -->
33

4+
* Fixed incorrect highlighting of options that were activated, removed
5+
and then re-added in "multiple" mode (#1212 and #1216)
6+
7+
*@sustmi*
8+
49
## v0.12.4, v0.12.5 · 27 June 2018
510

611
* Allow the dropdown to reopen on click if it is closed without losing focus

src/selectize.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,7 @@ $.extend(Selectize.prototype, {
15511551
if ($item.hasClass('active')) {
15521552
idx = self.$activeItems.indexOf($item[0]);
15531553
self.$activeItems.splice(idx, 1);
1554+
$item.removeClass('active');
15541555
}
15551556

15561557
self.items.splice(i, 1);

test/interaction.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,30 @@
406406
});
407407
});
408408

409+
describe('deleting active item', function() {
410+
it('should deactivate the item', function(done) {
411+
var test = setup_test('<select multiple="multiple">' +
412+
'<option value="a">A</option>' +
413+
'<option value="b">B</option>' +
414+
'</select>', {});
415+
416+
click(test.selectize.$control, function() {
417+
click($('[data-value="a"]', test.selectize.$dropdown), function() {
418+
click($('[data-value="a"]', test.selectize.$control), function() {
419+
syn
420+
.type('[backspace]', test.selectize.$control_input)
421+
.delay(5, function() {
422+
click($('[data-value="a"]', test.selectize.$dropdown), function () {
423+
expect($('[data-value="a"]', test.selectize.$control).hasClass('active')).to.be.equal(false);
424+
done();
425+
});
426+
});
427+
});
428+
});
429+
});
430+
});
431+
});
432+
409433
});
410434

411435
})();

0 commit comments

Comments
 (0)