Integrate new tab completion methods
There is now an option to choose which tab completion method to use. Also, emotes can be tab completed.
This commit is contained in:
parent
e1ad7c63af
commit
27e168ba8b
8 changed files with 109 additions and 9 deletions
|
|
@ -4,7 +4,7 @@ require('../../www/js/tabcomplete');
|
|||
|
||||
|
||||
describe('CyTube.tabCompletionMethods', () => {
|
||||
describe('"Longest unique prefix"', () => {
|
||||
describe('"Longest unique match"', () => {
|
||||
const testcases = [
|
||||
{
|
||||
input: 'and his name is j',
|
||||
|
|
@ -26,6 +26,16 @@ describe('CyTube.tabCompletionMethods', () => {
|
|||
},
|
||||
description: 'completes a unique match'
|
||||
},
|
||||
{
|
||||
input: 'johnc',
|
||||
position: 5,
|
||||
options: ['johncena', 'johnstamos', 'johto'],
|
||||
output: {
|
||||
text: 'johncena ',
|
||||
newPosition: 9
|
||||
},
|
||||
description: 'completes a unique match at the beginning of the string'
|
||||
},
|
||||
{
|
||||
input: 'and his name is johnc',
|
||||
position: 21,
|
||||
|
|
@ -70,7 +80,7 @@ describe('CyTube.tabCompletionMethods', () => {
|
|||
testcases.forEach(test => {
|
||||
it(test.description, () => {
|
||||
assert.deepEqual(
|
||||
CyTube.tabCompleteMethods['Longest unique prefix'](
|
||||
CyTube.tabCompleteMethods['Longest unique match'](
|
||||
test.input,
|
||||
test.position,
|
||||
test.options,
|
||||
|
|
@ -108,6 +118,30 @@ describe('CyTube.tabCompletionMethods', () => {
|
|||
],
|
||||
description: 'cycles through options correctly'
|
||||
},
|
||||
{
|
||||
input: 'c',
|
||||
position: 1,
|
||||
options: ['COBOL', 'Carlos', 'carl', 'john', 'joseph', ''],
|
||||
outputs: [
|
||||
{
|
||||
text: 'carl ',
|
||||
newPosition: 5
|
||||
},
|
||||
{
|
||||
text: 'Carlos ',
|
||||
newPosition: 7
|
||||
},
|
||||
{
|
||||
text: 'COBOL ',
|
||||
newPosition: 6
|
||||
},
|
||||
{
|
||||
text: 'carl ',
|
||||
newPosition: 5
|
||||
}
|
||||
],
|
||||
description: 'cycles through options correctly at the beginning of the string'
|
||||
},
|
||||
{
|
||||
input: 'hey ',
|
||||
position: 5,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue