@@ -1137,6 +1137,31 @@ describe('insertPastedData', () => {
11371137 ) ;
11381138 } ) ;
11391139
1140+ test ( 'pasting multi-line value' , async ( ) => {
1141+ const em = baseEditorModel . applyChanges ( {
1142+ selectionCells : [ genCellKey ( fkOne , 0 ) ] ,
1143+ selectedColIdx : 0 ,
1144+ selectedRowIdx : 2 ,
1145+ } ) ;
1146+ const changes = await validateAndInsertPastedData (
1147+ em ,
1148+ '"line1\nline2"' ,
1149+ undefined ,
1150+ true ,
1151+ true ,
1152+ undefined ,
1153+ true
1154+ ) ;
1155+ const cellValues = changes . cellValues ;
1156+ expect ( cellValues . get ( genCellKey ( fkOne , 2 ) ) ) . toEqual (
1157+ List ( [
1158+ { display : 'line1\nline2' , raw : 'line1\nline2' }
1159+ ] ) ) ;
1160+
1161+ const cellMessages = changes . cellMessages ;
1162+ expect ( cellMessages . get ( genCellKey ( fkOne , 2 ) ) ) . toBeUndefined ( ) ;
1163+ } ) ;
1164+
11401165 test ( 'pasting multi values' , async ( ) => {
11411166 const em = baseEditorModel . applyChanges ( {
11421167 selectionCells : [ genCellKey ( mvtc , 0 ) ] ,
@@ -1248,24 +1273,33 @@ describe('insertPastedData', () => {
12481273 selectedColIdx : 3 ,
12491274 selectedRowIdx : 0 ,
12501275 } ) ;
1251- const changes = await validateAndInsertPastedData ( em , 'A,B' , undefined , true , true , undefined , true ) ;
1252- // 'A,B' exactly matches a validValue, treated as a single value (not split on comma)
1276+ const changes = await validateAndInsertPastedData ( em , '"A,B"' , undefined , true , true , undefined , true ) ;
12531277 expect ( changes . cellValues . get ( genCellKey ( mvtc , 0 ) ) ) . toEqual ( List ( [ { display : 'A,B' , raw : 'A,B' } ] ) ) ;
12541278 expect ( changes . cellMessages . get ( genCellKey ( mvtc , 0 ) ) ) . toBeUndefined ( ) ;
12551279 } ) ;
12561280
1257- test ( 'pasting exactly A,B,C without quote into mvtc matches single valid value' , async ( ) => {
1281+ test ( 'pasting exactly A,B,C into mvtc matches single valid value' , async ( ) => {
12581282 const em = baseEditorModel . applyChanges ( {
12591283 selectionCells : [ genCellKey ( mvtc , 0 ) ] ,
12601284 selectedColIdx : 3 ,
12611285 selectedRowIdx : 0 ,
12621286 } ) ;
1263- const changes = await validateAndInsertPastedData ( em , 'A,B,C' , undefined , true , true , undefined , true ) ;
1264- // 'A,B' exactly matches a validValue, treated as a single value (not split on comma)
1287+ const changes = await validateAndInsertPastedData ( em , '"A,B,C"' , undefined , true , true , undefined , true ) ;
12651288 expect ( changes . cellValues . get ( genCellKey ( mvtc , 0 ) ) ) . toEqual ( List ( [ { display : 'A,B,C' , raw : 'A,B,C' } ] ) ) ;
12661289 expect ( changes . cellMessages . get ( genCellKey ( mvtc , 0 ) ) ) . toBeUndefined ( ) ;
12671290 } ) ;
12681291
1292+ test ( 'pasting escaped "A,B,C" into mvtc matches single valid value' , async ( ) => {
1293+ const em = baseEditorModel . applyChanges ( {
1294+ selectionCells : [ genCellKey ( mvtc , 0 ) ] ,
1295+ selectedColIdx : 3 ,
1296+ selectedRowIdx : 0 ,
1297+ } ) ;
1298+ const changes = await validateAndInsertPastedData ( em , '"""A,B,C"""' , undefined , true , true , undefined , true ) ;
1299+ expect ( changes . cellValues . get ( genCellKey ( mvtc , 0 ) ) ) . toEqual ( List ( [ { display : '"A,B,C"' , raw : '"A,B,C"' } ] ) ) ;
1300+ expect ( changes . cellMessages . get ( genCellKey ( mvtc , 0 ) ) ) . toBeUndefined ( ) ;
1301+ } ) ;
1302+
12691303 test ( 'pasting A, B with space into mvtc parses as two values' , async ( ) => {
12701304 const em = baseEditorModel . applyChanges ( {
12711305 selectionCells : [ genCellKey ( mvtc , 0 ) ] ,
@@ -1317,7 +1351,7 @@ describe('insertPastedData', () => {
13171351 } ) ;
13181352 const changes = await validateAndInsertPastedData (
13191353 em ,
1320- 'A,B\n"A,B",cc\nA,B,cc' ,
1354+ '" A,B" \n"A,B",cc\nA,B,cc' ,
13211355 undefined ,
13221356 true ,
13231357 true ,
0 commit comments