@@ -602,19 +602,38 @@ describe("cron view editor", () => {
602602 expect ( onClosePanel ) . toHaveBeenCalledTimes ( 1 ) ;
603603 } ) ;
604604
605- it ( "wires form changes from prompt and name inputs " , ( ) => {
605+ it ( "wires shared text and select controls without changing their field ownership " , ( ) => {
606606 const onFormChange = vi . fn ( ) ;
607- const container = renderView ( { createOpen : true , onFormChange } ) ;
607+ const container = renderView ( {
608+ createOpen : true ,
609+ channels : [ "telegram" ] ,
610+ channelMeta : [ { id : "telegram" , label : "" , detailLabel : "Telegram" } ] ,
611+ channelLabels : { telegram : "Telegram fallback" } ,
612+ form : { ...DEFAULT_CRON_FORM , scheduleKind : "cron" , failureAlertMode : "custom" } ,
613+ onFormChange,
614+ } ) ;
608615
609616 const prompt = getElement ( container , "#cron-payload-text" , HTMLTextAreaElement ) ;
610617 prompt . value = "do the thing" ;
611618 prompt . dispatchEvent ( new Event ( "input" , { bubbles : true } ) ) ;
612619 expect ( onFormChange ) . toHaveBeenCalledWith ( { payloadText : "do the thing" } ) ;
613620
614- const name = getElement ( container , "#cron-name" , HTMLInputElement ) ;
615- name . value = "Thing" ;
616- name . dispatchEvent ( new Event ( "input" , { bubbles : true } ) ) ;
617- expect ( onFormChange ) . toHaveBeenCalledWith ( { name : "Thing" } ) ;
621+ for ( const field of [ "name" , "sessionKey" , "deliveryAccountId" , "payloadModel" ] as const ) {
622+ const id = `cron-${ field . replace ( / [ A - Z ] / g, ( letter ) => `-${ letter . toLowerCase ( ) } ` ) } ` ;
623+ const input = getElement ( container , `#${ id } ` , HTMLInputElement ) ;
624+ if ( field === "sessionKey" || field === "deliveryAccountId" ) {
625+ expect ( input . placeholder ) . toBe ( field === "sessionKey" ? "agent:main:main" : "default" ) ;
626+ }
627+ input . value = field ;
628+ input . dispatchEvent ( new Event ( "input" , { bubbles : true } ) ) ;
629+ expect ( onFormChange ) . toHaveBeenLastCalledWith ( { [ field ] : field } ) ;
630+ }
631+
632+ const channel = getElement ( container , "#cron-failure-alert-channel" , HTMLSelectElement ) ;
633+ channel . value = "telegram" ;
634+ expect ( channel . selectedOptions [ 0 ] ?. textContent ) . toBe ( "Telegram fallback" ) ;
635+ channel . dispatchEvent ( new Event ( "change" , { bubbles : true } ) ) ;
636+ expect ( onFormChange ) . toHaveBeenLastCalledWith ( { failureAlertChannel : "telegram" } ) ;
618637 } ) ;
619638
620639 it ( "switches schedule inputs by segmented kind and wires kind changes" , ( ) => {
0 commit comments