Skip to content

Commit 161ceaf

Browse files
authored
Merge branch 'master' into fix990
2 parents 1b2278a + 05d862a commit 161ceaf

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Contributing to tom-select
2+
3+
We welcome contributions from anyone.
4+
5+
The only condition: be a human.
6+
7+
We don't want to have to maintain vibe coded crap code, and we won't.
8+
9+
On that basis, contributions made by Large Language Models will be discarded right away.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
},
4343
"description": "Tom Select is a versatile and dynamic <select> UI control. Forked from Selectize.js to provide a framework agnostic autocomplete widget with native-feeling keyboard navigation, it's useful for tagging, contact lists, country selectors, etc.",
4444
"homepage": "https://tom-select.js.org",
45-
"version": "2.5.1",
45+
"version": "2.5.2",
4646
"files": [
4747
"/dist",
4848
"/src"

src/tom-select.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,7 @@ export default class TomSelect extends MicroPlugin(MicroEvent){
16621662

16631663
const key = hash_key(data[self.settings.valueField]);
16641664
if( key === null || self.options.hasOwnProperty(key) ){
1665+
self.updateOption(data[self.settings.valueField], data);
16651666
return false;
16661667
}
16671668

test/html/bootstrap5.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ <h2>form-select with aria-label</h2>
2121

2222
<hr/>
2323

24-
<h2>form-select-sm</h2>
25-
<select class="form-select form-select-sm ts">
24+
<h2>form-select-sm multiple with clearAfterSelect</h2>
25+
<select multiple id='ts-multiple' class="form-select form-select-sm">
2626
<option value="1">Option 1</option>
2727
<option value="2">Option 2</option>
2828
<option value="3">Option 3</option>
@@ -47,6 +47,10 @@ <h2>form-select-lg</h2>
4747
onInitialize: () => console.log('TomSelect is now initialized'),
4848
});
4949
});
50+
// for multiple we use clearAfterSelect: true
51+
new TomSelect('#ts-multiple', {
52+
clearAfterSelect: true,
53+
});
5054
</script>
5155
</body>
5256
</html>

test/tests/api.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,13 @@
336336
expect(test.instance.options).to.have.property('a');
337337
expect(test.instance.options).to.have.property('b');
338338
});
339-
it_n('should not override existing options', function() {
339+
it_n('should update existing option when adding new one', function() {
340340
test.instance.addOption([{value: 'a'}, {value: 'b'}]);
341341
test.instance.addOption({value: 'a', test: 'hello'});
342-
expect(test.instance.options.a).to.not.have.property('test');
342+
expect(test.instance.options.a).to.have.property('test');
343+
});
344+
it_n('should be false when value is missing (null)', function() {
345+
expect(test.instance.addOption({value: null})).to.be.equal(false);
343346
});
344347
});
345348

0 commit comments

Comments
 (0)