@@ -12,7 +12,7 @@ import {
1212 TurnId ,
1313 type WorktreeSetupSnapshot ,
1414} from "@t3tools/contracts" ;
15- import { afterEach , beforeEach , describe , expect , it , vi } from "vite-plus/test" ;
15+ import { afterEach , describe , expect , it , vi } from "vite-plus/test" ;
1616import { Atom , AsyncResult } from "effect/unstable/reactivity" ;
1717import { appAtomRegistry } from "../rpc/atomRegistry" ;
1818import { environmentThreadDetails } from "../state/threads" ;
@@ -86,7 +86,6 @@ import {
8686 shouldShowBranchMismatchBanner ,
8787 shouldShowPlanFollowUpPrompt ,
8888 shouldWriteThreadErrorToCurrentServerThread ,
89- toolGroupConsumesUpwardNavigation ,
9089 waitForRevertedMessage ,
9190 prepareRevertedMessageAttachments ,
9291} from "./ChatView.logic" ;
@@ -446,134 +445,6 @@ describe("proactive panels", () => {
446445 } ) ;
447446} ) ;
448447
449- describe ( "toolGroupConsumesUpwardNavigation" , ( ) => {
450- class ScrollElement extends EventTarget {
451- scrollTop = 0 ;
452- scrollHeight = 100 ;
453- clientHeight = 100 ;
454- overflowY = "visible" ;
455-
456- constructor (
457- readonly parentElement : ScrollElement | null = null ,
458- readonly isToolGroup = false ,
459- ) {
460- super ( ) ;
461- }
462-
463- closest ( selector : string ) : ScrollElement | null {
464- if ( selector !== "[data-tool-group-scroll]" ) return null ;
465- return this . isToolGroup ? this : ( this . parentElement ?. closest ( selector ) ?? null ) ;
466- }
467- }
468-
469- beforeEach ( ( ) => {
470- vi . stubGlobal ( "Element" , ScrollElement ) ;
471- vi . stubGlobal ( "getComputedStyle" , ( element : ScrollElement ) => ( {
472- overflowY : element . overflowY ,
473- } ) ) ;
474- } ) ;
475- afterEach ( ( ) => vi . unstubAllGlobals ( ) ) ;
476-
477- it ( "releases upward navigation when an overflowing group is at the top" , ( ) => {
478- const group = Object . assign ( new ScrollElement ( null , true ) , {
479- overflowY : "auto" ,
480- scrollHeight : 300 ,
481- } ) ;
482-
483- expect ( toolGroupConsumesUpwardNavigation ( new ScrollElement ( group ) ) ) . toBe ( false ) ;
484- } ) ;
485-
486- it . each ( [
487- { overflowY : "auto" , scrollTop : 1 } ,
488- { overflowY : "auto" , scrollTop : 0.25 } ,
489- { overflowY : "scroll" , scrollTop : 80 } ,
490- ] ) ( "consumes upward navigation within a scrolled group: %j" , ( scroll ) => {
491- const group = Object . assign ( new ScrollElement ( null , true ) , {
492- scrollHeight : 300 ,
493- ...scroll ,
494- } ) ;
495-
496- expect ( toolGroupConsumesUpwardNavigation ( group ) ) . toBe ( true ) ;
497- } ) ;
498-
499- it . each ( [ 100 , 300 ] ) (
500- "consumes scrolling in a nested result with a group content height of %i" ,
501- ( scrollHeight ) => {
502- const group = Object . assign ( new ScrollElement ( null , true ) , {
503- overflowY : "auto" ,
504- scrollHeight,
505- } ) ;
506- const result = Object . assign ( new ScrollElement ( group ) , {
507- overflowY : "auto" ,
508- scrollHeight : 300 ,
509- scrollTop : 0.25 ,
510- } ) ;
511-
512- expect ( toolGroupConsumesUpwardNavigation ( new ScrollElement ( result ) ) ) . toBe ( true ) ;
513- } ,
514- ) ;
515-
516- it ( "releases upward navigation when the group and nested result are both at the top" , ( ) => {
517- const group = Object . assign ( new ScrollElement ( null , true ) , {
518- overflowY : "auto" ,
519- scrollHeight : 300 ,
520- } ) ;
521- const result = Object . assign ( new ScrollElement ( group ) , {
522- overflowY : "scroll" ,
523- scrollHeight : 300 ,
524- } ) ;
525-
526- expect ( toolGroupConsumesUpwardNavigation ( new ScrollElement ( result ) ) ) . toBe ( false ) ;
527- } ) ;
528-
529- it ( "ignores targets outside a tool group and non-element targets" , ( ) => {
530- const outside = Object . assign ( new ScrollElement ( ) , {
531- overflowY : "auto" ,
532- scrollHeight : 300 ,
533- scrollTop : 40 ,
534- } ) ;
535-
536- expect ( toolGroupConsumesUpwardNavigation ( outside ) ) . toBe ( false ) ;
537- expect ( toolGroupConsumesUpwardNavigation ( new EventTarget ( ) ) ) . toBe ( false ) ;
538- expect ( toolGroupConsumesUpwardNavigation ( null ) ) . toBe ( false ) ;
539- } ) ;
540-
541- it ( "does not consume scrolling from an ancestor beyond the tool group" , ( ) => {
542- const timeline = Object . assign ( new ScrollElement ( ) , {
543- overflowY : "auto" ,
544- scrollHeight : 300 ,
545- scrollTop : 40 ,
546- } ) ;
547- const group = new ScrollElement ( timeline , true ) ;
548-
549- expect ( toolGroupConsumesUpwardNavigation ( new ScrollElement ( group ) ) ) . toBe ( false ) ;
550- } ) ;
551-
552- it . each ( [ "hidden" , "clip" , "visible" ] ) (
553- "ignores a non-scrollable child with overflow-y %s" ,
554- ( overflowY ) => {
555- const group = new ScrollElement ( null , true ) ;
556- const result = Object . assign ( new ScrollElement ( group ) , {
557- overflowY,
558- scrollHeight : 300 ,
559- scrollTop : 40 ,
560- } ) ;
561-
562- expect ( toolGroupConsumesUpwardNavigation ( new ScrollElement ( result ) ) ) . toBe ( false ) ;
563- } ,
564- ) ;
565-
566- it ( "does not consume programmatic scrolling on an overflow-hidden group" , ( ) => {
567- const group = Object . assign ( new ScrollElement ( null , true ) , {
568- overflowY : "hidden" ,
569- scrollHeight : 300 ,
570- scrollTop : 40 ,
571- } ) ;
572-
573- expect ( toolGroupConsumesUpwardNavigation ( group ) ) . toBe ( false ) ;
574- } ) ;
575- } ) ;
576-
577448const environmentId = EnvironmentId . make ( "environment-local" ) ;
578449const projectId = ProjectId . make ( "project-1" ) ;
579450const threadId = ThreadId . make ( "thread-1" ) ;
0 commit comments