diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-05-31 16:14:28 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-05-31 16:14:28 -0400 |
commit | 12f659372786c9b9dd3261b4663a4e840da64372 (patch) | |
tree | ed7b3234df9ef277fa79759ced5897cc59e83049 /webapp/tests/suggestion_box.test.jsx | |
parent | 6e6257fccaa0c5837101dedbe7f547bc3cc6c6bb (diff) | |
download | chat-12f659372786c9b9dd3261b4663a4e840da64372.tar.gz chat-12f659372786c9b9dd3261b4663a4e840da64372.tar.bz2 chat-12f659372786c9b9dd3261b4663a4e840da64372.zip |
PLT-2643 Fixed asynchronous autocomplete incorrectly replacing text (#3167)
* Allowed different suggestions to match different text. Added a Suggestion base component. Improved text replacement used when filling in suggestions
* Fixed formatting
Diffstat (limited to 'webapp/tests/suggestion_box.test.jsx')
-rw-r--r-- | webapp/tests/suggestion_box.test.jsx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/webapp/tests/suggestion_box.test.jsx b/webapp/tests/suggestion_box.test.jsx new file mode 100644 index 000000000..6301482c2 --- /dev/null +++ b/webapp/tests/suggestion_box.test.jsx @@ -0,0 +1,20 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import assert from 'assert'; + +import SuggestionBox from 'components/suggestion/suggestion_box.jsx'; + +describe('SuggestionBox', function() { + it('findOverlap', function(done) { + assert.equal(SuggestionBox.findOverlap('', 'blue'), ''); + assert.equal(SuggestionBox.findOverlap('red', ''), ''); + assert.equal(SuggestionBox.findOverlap('red', 'blue'), ''); + assert.equal(SuggestionBox.findOverlap('red', 'dog'), 'd'); + assert.equal(SuggestionBox.findOverlap('red', 'education'), 'ed'); + assert.equal(SuggestionBox.findOverlap('red', 'reduce'), 'red'); + assert.equal(SuggestionBox.findOverlap('black', 'ack'), 'ack'); + + done(); + }); +});
\ No newline at end of file |