2222 * the ruling's default — one form-level notice under the form's existing
2323 * outcome-toast id, naming every cleared column at once, so it retires like the
2424 * form's other outcome messages: a later submit outcome supersedes it, and the
25- * dismissal at the next attempt takes it down.
25+ * dismissal at the next attempt takes it down. A client-side refusal raises no
26+ * toast of its own (objectstack#25874 — each field's message carries it), so
27+ * that attempt dismisses the id instead of superseding it.
2628 *
2729 * Only a field that HELD something is named: an already-empty value, an empty
2830 * list and an unchecked two-state control (whose empty state is `false`) are
@@ -199,7 +201,7 @@ describe('#8070 — a visibleWhen clear is named to the user', () => {
199201 expect ( notices ( ) [ 1 ] ) . not . toContain ( 'Contact' ) ;
200202 } ) ;
201203
202- it ( 'a later submit refusal supersedes the notice, and the next accepted attempt retires it — one id throughout' , async ( ) => {
204+ it ( 'a later submit attempt retires the notice, refused or accepted — one id throughout' , async ( ) => {
203205 const onSubmit = vi . fn ( ) ;
204206 renderForm ( {
205207 fields : [ { name : 'subject' , label : 'Subject' , type : 'input' , required : true } , ...FIELDS . slice ( 0 , 2 ) ] ,
@@ -211,13 +213,15 @@ describe('#8070 — a visibleWhen clear is named to the user', () => {
211213 await waitFor ( ( ) => expect ( warningSpy ) . toHaveBeenCalledTimes ( 1 ) ) ;
212214 const noticeId = ( warningSpy . mock . calls [ 0 ] [ 1 ] as { id : string } ) . id ;
213215
214- // Refused on the client: the refusal is published under the SAME id, which
215- // sonner treats as an update of the notice rather than a second toast .
216+ // Refused on the client: the refusal is the inline message under Subject,
217+ // and the attempt dismisses the notice's id rather than leaving it up .
216218 save ( ) ;
217- await waitFor ( ( ) => expect ( errorSpy ) . toHaveBeenCalledTimes ( 1 ) ) ;
218- expect ( errorSpy . mock . calls [ 0 ] [ 1 ] ) . toMatchObject ( { id : noticeId } ) ;
219+ await waitFor ( ( ) => expect ( dismissSpy ) . toHaveBeenCalledWith ( noticeId ) ) ;
220+ expect ( errorSpy ) . not . toHaveBeenCalled ( ) ;
221+ expect ( onSubmit ) . not . toHaveBeenCalled ( ) ;
219222
220- // Accepted on the client: the attempt starts by dismissing that id.
223+ // Accepted on the client: the attempt starts by dismissing that id too.
224+ dismissSpy . mockClear ( ) ;
221225 fireEvent . change ( screen . getByLabelText ( / s u b j e c t / i) , { target : { value : 'Kickoff' } } ) ;
222226 save ( ) ;
223227 await waitFor ( ( ) => expect ( onSubmit ) . toHaveBeenCalledTimes ( 1 ) ) ;
0 commit comments