@@ -102,15 +102,22 @@ describe('objectui#12514 — Validations: the empty block opens the header’s N
102102 expect ( menuIds ( 'rule-preset-' ) ) . toEqual ( fromEmpty ) ;
103103 } ) ;
104104
105- it ( 'a pick from it writes the rule the header’s pick writes' , ( ) => {
105+ it ( 'a pick from it writes the rule the header’s pick writes' , async ( ) => {
106106 const fromEmpty = vi . fn ( ) ;
107107 render ( < Harness onPatch = { fromEmpty } /> ) ;
108108 fireEvent . click ( screen . getByTestId ( 'rules-empty-new' ) ) ;
109109 fireEvent . click ( screen . getByRole ( 'button' , { name : 'Advanced' } ) ) ;
110110 fireEvent . click ( screen . getByRole ( 'button' , { name : t ( 'engine.studio.rules.typeFormat' , 'en' ) } ) ) ;
111- expect ( fromEmpty ) . toHaveBeenCalledTimes ( 1 ) ;
112111 // The rule is listed and open: the block gave way to the list.
113112 expect ( screen . queryByTestId ( 'rules-empty' ) ) . toBeNull ( ) ;
113+ // objectstack#26731 — a new Format rule is written once it has a field and a message.
114+ expect ( fromEmpty ) . not . toHaveBeenCalled ( ) ;
115+ fireEvent . keyDown ( screen . getByTestId ( 'rule-field' ) , { key : 'ArrowDown' } ) ;
116+ fireEvent . click ( within ( await screen . findByRole ( 'listbox' ) ) . getByRole ( 'option' , { name : 'Name (name)' } ) ) ;
117+ fireEvent . change ( screen . getByPlaceholderText ( t ( 'engine.studio.rules.messagePlaceholder' , 'en' ) ) , {
118+ target : { value : 'Bad name' } ,
119+ } ) ;
120+ expect ( fromEmpty ) . toHaveBeenCalledTimes ( 1 ) ;
114121 } ) ;
115122
116123 it ( 'once the first rule lists, the menu hands focus to the header’s New' , async ( ) => {
0 commit comments