@@ -3,11 +3,7 @@ import { describe, expect, it, vi } from "vitest";
33import { CONTROL_UI_BASE_PATH_ATTRIBUTE } from "../../../src/gateway/control-ui-contract.js" ;
44import type { GatewayBrowserClient } from "../api/gateway.ts" ;
55import { routeIdFromPath , type RouteId } from "../app-routes.ts" ;
6- import {
7- SIDEBAR_SESSION_NAV_COLLAPSE_QUERY ,
8- sessionRefFromPath ,
9- withSidebarNavCollapseIntent ,
10- } from "../app-session-route-paths.ts" ;
6+ import { sessionRefFromPath } from "../app-session-route-paths.ts" ;
117import {
128 isDefaultChatLanding ,
139 startModelSetupFirstRunRedirectAfterLocation ,
@@ -25,9 +21,6 @@ import { normalizeLegacyTerminalViewLocation } from "./startup-settings.ts";
2521// performance assertion, so these waits must not inherit vi.waitFor's 1s default:
2622// under a loaded CI runner that budget expires before startup reaches the step.
2723const STARTUP_STEP_WAIT = { timeout : 15_000 } ;
28- const SIDEBAR_COLLAPSE_SEARCH = new URLSearchParams ( {
29- [ SIDEBAR_SESSION_NAV_COLLAPSE_QUERY . name ] : SIDEBAR_SESSION_NAV_COLLAPSE_QUERY . value ,
30- } ) . toString ( ) ;
3124
3225function deferred < T > ( ) {
3326 let resolve ! : ( value : T ) => void ;
@@ -37,17 +30,6 @@ function deferred<T>() {
3730 return { promise, resolve } ;
3831}
3932
40- describe ( "withSidebarNavCollapseIntent" , ( ) => {
41- it . each ( [
42- [ "/chat/main/research" , "/chat/main/research?nav=collapsed" ] ,
43- [ "/chat/main?catalog=codex&thread=one" , "/chat/main?catalog=codex&thread=one&nav=collapsed" ] ,
44- [ "/chat/main?nav=collapsed&catalog=codex" , "/chat/main?nav=collapsed&catalog=codex" ] ,
45- [ "/chat/main?catalog=codex#details" , "/chat/main?catalog=codex&nav=collapsed#details" ] ,
46- ] ) ( "marks %s exactly once while preserving its route" , ( href , expected ) => {
47- expect ( withSidebarNavCollapseIntent ( href ) ) . toBe ( expected ) ;
48- } ) ;
49- } ) ;
50-
5133describe ( "normalizeLegacyTerminalViewLocation" , ( ) => {
5234 it . each ( [
5335 {
@@ -557,67 +539,6 @@ describe("normalizeInitialApplicationLocation", () => {
557539 }
558540 } ) ;
559541
560- it . each ( [
561- {
562- initialUrl : `/chat/research/conversation?keep=yes&${ SIDEBAR_COLLAPSE_SEARCH } #details` ,
563- expectedUrl : "/chat/research/conversation?keep=yes#details" ,
564- navCollapsed : true ,
565- } ,
566- {
567- initialUrl : `/chat/research?${ SIDEBAR_COLLAPSE_SEARCH } ` ,
568- expectedUrl : "/chat/research" ,
569- navCollapsed : true ,
570- } ,
571- {
572- initialUrl : `/chat?${ SIDEBAR_COLLAPSE_SEARCH } ` ,
573- expectedUrl : "/chat" ,
574- navCollapsed : false ,
575- } ,
576- {
577- initialUrl : `/dashboard/research/conversation?${ SIDEBAR_COLLAPSE_SEARCH } ` ,
578- expectedUrl : "/dashboard/research/conversation" ,
579- navCollapsed : false ,
580- } ,
581- {
582- initialUrl : "/settings/appearance" ,
583- expectedUrl : "/settings/appearance" ,
584- navCollapsed : false ,
585- } ,
586- ] ) ( "seeds sidebar visibility once from explicit new-tab intent at $initialUrl" , ( testCase ) => {
587- const previousSettings = loadSettings ( ) ;
588- const previousUrl = window . location . href ;
589- window . history . replaceState ( { } , "" , testCase . initialUrl ) ;
590- let runtime : ReturnType < typeof bootstrapApplication > | undefined ;
591-
592- try {
593- runtime = bootstrapApplication ( { sessionPathBuilderReady : deferred < void > ( ) . promise } ) ;
594- expect ( runtime . context . navigation . snapshot . navCollapsed ) . toBe ( testCase . navCollapsed ) ;
595- expect ( `${ window . location . pathname } ${ window . location . search } ${ window . location . hash } ` ) . toBe (
596- testCase . expectedUrl ,
597- ) ;
598- } finally {
599- runtime ?. stop ( ) ;
600- window . history . replaceState ( { } , "" , previousUrl ) ;
601- saveSettings ( previousSettings ) ;
602- }
603- } ) ;
604-
605- it ( "keeps the sidebar expanded for an unmarked chat-session deep link" , ( ) => {
606- const previousSettings = loadSettings ( ) ;
607- const previousUrl = window . location . href ;
608- window . history . replaceState ( { } , "" , "/chat/research/conversation" ) ;
609- let runtime : ReturnType < typeof bootstrapApplication > | undefined ;
610-
611- try {
612- runtime = bootstrapApplication ( { sessionPathBuilderReady : deferred < void > ( ) . promise } ) ;
613- expect ( runtime . context . navigation . snapshot . navCollapsed ) . toBe ( false ) ;
614- } finally {
615- runtime ?. stop ( ) ;
616- window . history . replaceState ( { } , "" , previousUrl ) ;
617- saveSettings ( previousSettings ) ;
618- }
619- } ) ;
620-
621542 it ( "does not rewrite browser history when startup contains no URL credentials" , ( ) => {
622543 const previousSettings = loadSettings ( ) ;
623544 const previousUrl = window . location . href ;
0 commit comments