diff --git a/assets/js/__tests__/tagsinput.spec.ts b/assets/js/__tests__/tagsinput.spec.ts index e32b2dfc..3c46eddc 100644 --- a/assets/js/__tests__/tagsinput.spec.ts +++ b/assets/js/__tests__/tagsinput.spec.ts @@ -1,6 +1,5 @@ import { $, $$, hideEl } from '../utils/dom'; import { assertNotNull } from '../utils/assert'; -import { TermSuggestion } from '../utils/suggestions'; import { setupTagsInput, addTag, reloadTagsInput } from '../tagsinput'; const formData = `
@@ -96,7 +95,7 @@ describe('Fancy tags input', () => { it('should respond to autocomplete events', () => { setupTagsInput(tagBlock); - fancyText.dispatchEvent(new CustomEvent('autocomplete', { detail: { value: 'a', label: 'a' } })); + fancyText.dispatchEvent(new CustomEvent('autocomplete', { detail: 'a' })); expect($$('span.tag', fancyInput)).toHaveLength(1); }); diff --git a/assets/js/tagsinput.ts b/assets/js/tagsinput.ts index 8a7d4b06..19396d80 100644 --- a/assets/js/tagsinput.ts +++ b/assets/js/tagsinput.ts @@ -4,7 +4,6 @@ import { assertNotNull, assertType } from './utils/assert'; import { $, $$, clearEl, removeEl, showEl, hideEl, escapeCss, escapeHtml } from './utils/dom'; -import { TermSuggestion } from './utils/suggestions'; export function setupTagsInput(tagBlock: HTMLDivElement) { const form = assertNotNull(tagBlock.closest('form')); @@ -48,8 +47,8 @@ export function setupTagsInput(tagBlock: HTMLDivElement) { importTags(); } - function handleAutocomplete(event: CustomEvent) { - insertTag(event.detail.value); + function handleAutocomplete(event: CustomEvent) { + insertTag(event.detail); inputField.focus(); }