@@ -16,10 +16,6 @@ function createContext(): DevframeHubContext {
1616 resolveOrigin : ( ) => 'http://localhost:5173' ,
1717 getStorageDir : ( ) => storageDir ,
1818 } ,
19- // Minimal stubs so the built-in `~terminals`/`~messages` getters
20- // (`when`/`badge`) can be evaluated without a full context.
21- terminals : { sessions : new Map ( ) } ,
22- messages : { entries : new Map ( ) } ,
2319 } as unknown as DevframeHubContext
2420}
2521
@@ -38,7 +34,7 @@ describe('devframeDockHost remote URL enrichment', () => {
3834 remote : true ,
3935 } )
4036
41- const first = host . values ( { includeBuiltin : false } ) [ 0 ]
37+ const first = host . values ( ) [ 0 ]
4238 expect ( first . type ) . toBe ( 'iframe' )
4339 const firstUrl = first . type === 'iframe' ? first . url : ''
4440 expect ( firstUrl ) . toContain ( `#/inspect?tab=state&${ REMOTE_CONNECTION_KEY } =` )
@@ -57,7 +53,7 @@ describe('devframeDockHost remote URL enrichment', () => {
5753 remote : true ,
5854 } )
5955
60- const second = host . values ( { includeBuiltin : false } ) [ 0 ]
56+ const second = host . values ( ) [ 0 ]
6157 const secondUrl = second . type === 'iframe' ? second . url : ''
6258 expect ( secondUrl . match ( new RegExp ( REMOTE_CONNECTION_KEY , 'g' ) ) ) . toHaveLength ( 1 )
6359 expect ( secondUrl ) . toContain ( '#/inspect?tab=state&' )
@@ -77,7 +73,7 @@ describe('devframeDockHost remote URL enrichment', () => {
7773 remote : true ,
7874 } )
7975
80- const entry = host . values ( { includeBuiltin : false } ) [ 0 ]
76+ const entry = host . values ( ) [ 0 ]
8177 const url = entry . type === 'iframe' ? entry . url : ''
8278 expect ( url ) . toContain ( `#section&${ REMOTE_CONNECTION_KEY } =` )
8379 expect ( parseRemoteConnection ( url ) ?. websocket ) . toBe ( 'ws://localhost:4173' )
@@ -101,7 +97,7 @@ describe('devframeDockHost grouping', () => {
10197
10298 expect ( host . views . has ( 'nuxt' ) ) . toBe ( true )
10399 expect ( emitted ) . toEqual ( [ 'nuxt' ] )
104- const entry = host . values ( { includeBuiltin : false } ) [ 0 ]
100+ const entry = host . values ( ) [ 0 ]
105101 expect ( entry . type ) . toBe ( 'group' )
106102 expect ( entry ) . toMatchObject ( { id : 'nuxt' , defaultChildId : 'nuxt:overview' } )
107103 } )
@@ -117,7 +113,7 @@ describe('devframeDockHost grouping', () => {
117113 groupId : 'nuxt' ,
118114 } )
119115
120- const entry = host . values ( { includeBuiltin : false } ) [ 0 ]
116+ const entry = host . values ( ) [ 0 ]
121117 expect ( entry . groupId ) . toBe ( 'nuxt' )
122118 } )
123119
@@ -138,7 +134,7 @@ describe('devframeDockHost grouping', () => {
138134 icon : 'logos:nuxt-icon' ,
139135 } )
140136
141- const ids = host . values ( { includeBuiltin : false } ) . map ( entry => entry . id )
137+ const ids = host . values ( ) . map ( entry => entry . id )
142138 expect ( ids ) . toEqual ( [ 'nuxt:overview' , 'nuxt' ] )
143139 } )
144140
@@ -194,33 +190,40 @@ describe('devframeDockHost grouping', () => {
194190 } )
195191} )
196192
197- describe ( 'devframeDockHost built-in gating ' , ( ) => {
198- it ( 'includes all three built-ins by default ' , ( ) => {
193+ describe ( 'devframeDockHost ~builtin category default ' , ( ) => {
194+ it ( 'returns no docks until an integration registers one ' , ( ) => {
199195 const host = new DevframeDocksHost ( createContext ( ) )
200- const ids = host . values ( ) . map ( entry => entry . id )
201- expect ( ids ) . toEqual ( [ '~terminals' , '~messages' , '~settings' ] )
196+ expect ( host . values ( ) ) . toEqual ( [ ] )
202197 } )
203198
204- it ( 'treats an empty builtinDocks map as all-enabled' , ( ) => {
205- const host = new DevframeDocksHost ( createContext ( ) , { } )
206- const ids = host . values ( ) . map ( entry => entry . id )
207- expect ( ids ) . toEqual ( [ '~terminals' , '~messages' , '~settings' ] )
208- } )
199+ it ( 'defaults a ~builtin view without a category to the ~builtin category' , ( ) => {
200+ const host = new DevframeDocksHost ( createContext ( ) )
201+ host . register ( {
202+ type : '~builtin' ,
203+ id : '~settings' ,
204+ title : 'Settings' ,
205+ icon : 'ph:gear-duotone' ,
206+ } )
209207
210- it ( 'omits the built-ins gated with `false`, keeping the rest' , ( ) => {
211- const host = new DevframeDocksHost ( createContext ( ) , { terminals : false , messages : false } )
212- const ids = host . values ( ) . map ( entry => entry . id )
213- expect ( ids ) . toEqual ( [ '~settings' ] )
208+ const entry = host . values ( ) [ 0 ]
209+ expect ( entry ) . toMatchObject ( { id : '~settings' , type : '~builtin' , category : '~builtin' } )
214210 } )
215211
216- it ( 'keeps an explicitly-enabled built-in and drops an omitted-as-false sibling' , ( ) => {
217- const host = new DevframeDocksHost ( createContext ( ) , { terminals : true , settings : false } )
218- const ids = host . values ( ) . map ( entry => entry . id )
219- expect ( ids ) . toEqual ( [ '~terminals' , '~messages' ] )
212+ it ( 'preserves an explicit category on a ~builtin view' , ( ) => {
213+ const host = new DevframeDocksHost ( createContext ( ) )
214+ host . register ( {
215+ type : '~builtin' ,
216+ id : '~settings' ,
217+ title : 'Settings' ,
218+ icon : 'ph:gear-duotone' ,
219+ category : 'app' ,
220+ } )
221+
222+ expect ( host . values ( ) [ 0 ] . category ) . toBe ( 'app' )
220223 } )
221224
222- it ( 'keeps user views ahead of gated built-ins ' , ( ) => {
223- const host = new DevframeDocksHost ( createContext ( ) , { messages : false , settings : false } )
225+ it ( 'leaves a non-builtin view without a category untouched ' , ( ) => {
226+ const host = new DevframeDocksHost ( createContext ( ) )
224227 host . register ( {
225228 type : 'iframe' ,
226229 id : 'app:overview' ,
@@ -229,12 +232,6 @@ describe('devframeDockHost built-in gating', () => {
229232 url : '/__app/' ,
230233 } )
231234
232- const ids = host . values ( ) . map ( entry => entry . id )
233- expect ( ids ) . toEqual ( [ 'app:overview' , '~terminals' ] )
234- } )
235-
236- it ( 'drops every built-in when includeBuiltin is false, regardless of gating' , ( ) => {
237- const host = new DevframeDocksHost ( createContext ( ) , { terminals : true , messages : true , settings : true } )
238- expect ( host . values ( { includeBuiltin : false } ) ) . toEqual ( [ ] )
235+ expect ( host . values ( ) [ 0 ] . category ) . toBeUndefined ( )
239236 } )
240237} )
0 commit comments