@@ -1488,6 +1488,39 @@ describe('Auto Completion Tests', () => {
14881488 . then ( done , done ) ;
14891489 } ) ;
14901490
1491+ it ( 'Array of enum autocomplete on 2nd position without `-`' , ( done ) => {
1492+ languageService . addSchema ( SCHEMA_ID , {
1493+ type : 'object' ,
1494+ properties : {
1495+ references : {
1496+ type : 'array' ,
1497+ items : {
1498+ enum : [ 'Test' ] ,
1499+ } ,
1500+ } ,
1501+ } ,
1502+ } ) ;
1503+ const content = 'references:\n - Test\n |\n|' ;
1504+ const completion = parseSetup ( content ) ;
1505+ completion
1506+ . then ( function ( result ) {
1507+ assert . deepEqual (
1508+ result . items . map ( ( i ) => ( { label : i . label , insertText : i . insertText } ) ) ,
1509+ [
1510+ {
1511+ insertText : 'Test' ,
1512+ label : 'Test' ,
1513+ } ,
1514+ {
1515+ insertText : '- $1\n' ,
1516+ label : '- (array item) ' ,
1517+ } ,
1518+ ]
1519+ ) ;
1520+ } )
1521+ . then ( done , done ) ;
1522+ } ) ;
1523+
14911524 it ( 'Array of objects autocomplete with 4 space indentation check' , async ( ) => {
14921525 const languageSettingsSetup = new ServiceSetup ( ) . withCompletion ( ) . withIndentation ( ' ' ) ;
14931526 languageService . configure ( languageSettingsSetup . languageSettings ) ;
@@ -1926,7 +1959,8 @@ describe('Auto Completion Tests', () => {
19261959 assert . equal ( result . items . length , 3 , `Expecting 3 items in completion but found ${ result . items . length } ` ) ;
19271960
19281961 const resultDoc2 = await parseSetup ( content , content . length ) ;
1929- assert . equal ( resultDoc2 . items . length , 0 , `Expecting no items in completion but found ${ resultDoc2 . items . length } ` ) ;
1962+ assert . equal ( resultDoc2 . items . length , 1 , `Expecting 1 item in completion but found ${ resultDoc2 . items . length } ` ) ;
1963+ assert . equal ( resultDoc2 . items [ 0 ] . label , '- (array item) ' ) ;
19301964 } ) ;
19311965
19321966 it ( 'should handle absolute path' , async ( ) => {
0 commit comments