Fix removing item twice

Add spec which is fixed with this commit.

In the `sTagsArea` zone there are two elements with the same `data-val`:
the `<span class="amsify-select-tag>` containing the selected tag and
the `<li class="amsify-list-item" data-val="1">` containing the
suggested tag.

This means every time we call `removeTag`, the `removeTagByItem`
function is called twice, and might remove extra items.

Suggested PR:
c8765a6915
This commit is contained in:
taitus
2021-01-20 13:36:56 +01:00
parent 23f72d939a
commit f463baf14a
2 changed files with 12 additions and 2 deletions

View File

@@ -626,7 +626,7 @@ var AmsifySuggestags;
removeTag: function(value, animate=true) {
var _self = this;
$findTags = $(this.selectors.sTagsArea).find('[data-val="'+value+'"]');
$findTags = $(this.selectors.inputArea).find('[data-val="'+value+'"]');
if($findTags.length) {
$findTags.each(function(){
_self.removeTagByItem(this, animate);