-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add autocompleteSeparator parameter (#406)
* push improved autocomplete functionality * actual autocomplete fixes * push missing changes * add autocompleteSeparator parameter * remove debugger * make gulfile syntax more consistent * remove unnecessary gulpfile changes * test autocompleteSeparator Co-authored-by: Valentin Steinwandter <[email protected]>
- Loading branch information
1 parent
b086424
commit 2d03516
Showing
10 changed files
with
143 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules | |
.DS_Store | ||
npm-debug.log | ||
test/coverage | ||
yarn-error.log | ||
yarn-error.log | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,6 +172,43 @@ describe("Tribute autocomplete mode cases", function() { | |
clearDom(); | ||
}); | ||
|
||
['text', 'contenteditable'].forEach(elementType => { | ||
it(`when values key with autocompleteSeparator option. For : ${elementType}`, () => { | ||
let input = createDomElement(elementType); | ||
|
||
let collectionObject = { | ||
selectTemplate: function (item) { | ||
return item.original.value; | ||
}, | ||
autocompleteMode: true, | ||
autocompleteSeparator: new RegExp(/\-|\+/), | ||
values: [ | ||
{ key: 'Jordan Humphreys', value: 'Jordan Humphreys', email: '[email protected]' }, | ||
{ key: 'Sir Walter Riley', value: 'Sir Walter Riley', email: '[email protected]' } | ||
], | ||
} | ||
|
||
let tribute = attachTribute(collectionObject, input.id); | ||
|
||
fillIn(input, '+J'); | ||
let popupList = document.querySelectorAll('.tribute-container > ul > li'); | ||
expect(popupList.length).toBe(1); | ||
simulateMouseClick(popupList[0]); // click on Jordan Humphreys | ||
|
||
if (elementType === 'text') { | ||
expect(input.value).toBe('+Jordan Humphreys '); | ||
} else if (elementType === 'contenteditable') { | ||
expect(input.innerText).toBe('+Jordan Humphreys '); | ||
} | ||
|
||
fillIn(input, ' Si'); | ||
popupList = document.querySelectorAll('.tribute-container > ul > li'); | ||
expect(popupList.length).toBe(1); | ||
|
||
detachTribute(tribute, input.id); | ||
}); | ||
}); | ||
|
||
["text", "contenteditable"].forEach(elementType => { | ||
it(`when values key is predefined array. For : ${elementType}`, () => { | ||
let input = createDomElement(elementType); | ||
|