@@ -369,6 +369,28 @@ describe('Cell', () => {
369369 expect ( a1 . model . comment . note ) . to . deep . equal ( comment ) ;
370370 } ) ;
371371
372+ it ( 'can remove comment' , ( ) => {
373+ const a1 = sheetMock . getCell ( 'A1' ) ;
374+
375+ expect ( a1 . note ) . to . be . undefined ( ) ;
376+
377+ a1 . note = 'Some note' ;
378+ expect ( a1 . model . comment . note . texts [ 0 ] . text ) . to . be . eq ( 'Some note' ) ;
379+
380+ a1 . removeNote ( ) ;
381+ expect ( a1 . model . comment ) . to . be . undefined ( ) ;
382+ } ) ;
383+
384+ it ( 'fails to remove comment by assigning empty object' , ( ) => {
385+ const a1 = sheetMock . getCell ( 'A1' ) ;
386+ a1 . note = 'Some note' ;
387+
388+ expect ( a1 . model . comment . note . texts [ 0 ] . text ) . to . be . eq ( 'Some note' ) ;
389+
390+ a1 . note = { } ;
391+ expect ( a1 . model . comment ) . to . exist ( ) ;
392+ } ) ;
393+
372394 it ( 'Cell comments supports setting margins, protection, and position properties' , ( ) => {
373395 const a1 = sheetMock . getCell ( 'A1' ) ;
374396
@@ -399,10 +421,7 @@ describe('Cell', () => {
399421 expect ( a1 . model . comment . note . protection ) . to . deep . equal ( comment . protection ) ;
400422 expect ( a1 . model . comment . note . margins . insetmode ) . to . equal ( 'auto' ) ;
401423 expect ( a1 . model . comment . note . margins . inset ) . to . deep . equal ( [
402- 0.13 ,
403- 0.13 ,
404- 0.25 ,
405- 0.25 ,
424+ 0.13 , 0.13 , 0.25 , 0.25 ,
406425 ] ) ;
407426 expect ( a1 . model . comment . note . editAs ) . to . equal ( 'absolute' ) ;
408427 } ) ;
0 commit comments