File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed
test/development/client-dev-overlay Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ const MenuPanel = () => {
9292 value : < ChevronRight /> ,
9393 onClick : ( ) => setPanel ( 'turbo-info' ) ,
9494 } ,
95+ ! ! process . env . __NEXT_CACHE_COMPONENTS && {
96+ title : 'Cache Components is enabled.' ,
97+ label : 'Cache Components' ,
98+ value : 'Enabled' ,
99+ } ,
95100 isAppRouter && {
96101 label : 'Route Info' ,
97102 value : < ChevronRight /> ,
Original file line number Diff line number Diff line change @@ -156,3 +156,64 @@ describe('client-dev-overlay', () => {
156156 }
157157 } )
158158} )
159+
160+ describe ( 'client-dev-overlay with Cache Components' , ( ) => {
161+ const { next, isTurbopack } = nextTestSetup ( {
162+ files : {
163+ pages : new FileRef ( join ( __dirname , 'pages' ) ) ,
164+ 'next.config.js' : `
165+ module.exports = {
166+ cacheComponents: true,
167+ }
168+ ` ,
169+ } ,
170+ env : {
171+ __NEXT_DEV_INDICATOR_COOLDOWN_MS : '0' ,
172+ } ,
173+ } )
174+
175+ it ( 'should show Cache Components as enabled in the devtools menu' , async ( ) => {
176+ const browser = await next . browser ( '/' )
177+
178+ const devToolsIndicator = await assertHasDevToolsIndicator ( browser )
179+ try {
180+ await devToolsIndicator . click ( )
181+ } catch ( cause ) {
182+ const error = new Error ( 'No DevTools Indicator to open.' , { cause } )
183+ throw error
184+ }
185+
186+ const devtoolsMenu = await browser . elementByCss ( '#nextjs-dev-tools-menu' )
187+ const menuText = await devtoolsMenu . innerText ( )
188+
189+ // Should include Cache Components
190+ expect ( menuText ) . toContain ( 'Cache Components' )
191+ expect ( menuText ) . toContain ( 'Enabled' )
192+
193+ // Should also include Turbopack info
194+ if ( isTurbopack ) {
195+ expect ( menuText ) . toMatchInlineSnapshot ( `
196+ "Issues
197+ 1
198+ Route
199+ Static
200+ Turbopack
201+ Enabled
202+ Cache Components
203+ Enabled
204+ Preferences"
205+ ` )
206+ } else {
207+ expect ( menuText ) . toMatchInlineSnapshot ( `
208+ "Issues
209+ 1
210+ Route
211+ Static
212+ Try Turbopack
213+ Cache Components
214+ Enabled
215+ Preferences"
216+ ` )
217+ }
218+ } )
219+ } )
You can’t perform that action at this time.
0 commit comments