@@ -298,3 +298,30 @@ test('durable task cards distinguish paused, unconfirmed and waiting states with
298298 assert . match ( document . querySelector ( '.task-list' ) . textContent , / R e s e a r c h / ) ;
299299 closeOverlay ( ) ; state . tasks = [ ] ;
300300} ) ;
301+
302+ test ( 'the group note record stays visible and clearable while the switch is off' , async ( ) => {
303+ requests = [ ] ;
304+ state . groups = [ {
305+ id : 'g1' , name : 'Team' , notice : '' , adminId : 'b1' , memberIds : [ 'b1' ] , replyMode : 'admin' ,
306+ notes : false , noteEntries : [ { speaker : 'Rob' , text : 'we go with plan B' } ] ,
307+ } ] ;
308+ state . current = 'group:g1' ;
309+ state . drawer = { open : true , view : 'overview' , memTab : 'self' , dirty : false } ;
310+ renderDrawer ( ) ; await tick ( ) ;
311+ const drawer = document . getElementById ( 'drawer' ) ;
312+ // The record is shown even though the switch is off: what was recorded has to stay readable.
313+ assert . match ( drawer . textContent , / w e g o w i t h p l a n B / ) ;
314+ assert . match ( drawer . textContent , / n e i t h e r a d d e d t o n o r r e a d b y t h e B o t s / ) ;
315+ // And it can still be cleared.
316+ const clear = [ ...drawer . querySelectorAll ( 'button' ) ] . find ( ( button ) => button . textContent . includes ( 'Clear the note' ) ) ;
317+ assert . ok ( clear , 'the record can still be cleared' ) ;
318+ clear . click ( ) ; await tick ( ) ;
319+ const cleared = requests . find ( ( r ) => r . url . includes ( '/api/groups/g1' ) && r . method === 'PATCH' ) ;
320+ assert . ok ( cleared , 'clearing goes to the group API' ) ;
321+ assert . deepEqual ( cleared . body , { clearNotes : true } ) ;
322+ // With the switch on, the panel does not claim the record is kept.
323+ state . groups [ 0 ] . notes = true ;
324+ renderDrawer ( ) ; await tick ( ) ;
325+ assert . doesNotMatch ( document . getElementById ( 'drawer' ) . textContent , / n e i t h e r a d d e d t o n o r r e a d / ) ;
326+ state . groups = [ ] ; state . current = 'bot:b1' ;
327+ } ) ;
0 commit comments