@@ -62,7 +62,7 @@ test('clear component diagnostics removes type errors and restores rendered stat
6262 await expect ( page . getByText ( / R e n d e r e d \( T y p e e r r o r s : [ 1 - 9 ] \d * \) / ) ) . toBeVisible ( )
6363
6464 await ensureDiagnosticsDrawerOpen ( page )
65- await page . getByRole ( 'button' , { name : 'Reset component ' } ) . click ( )
65+ await page . getByRole ( 'button' , { name : 'Reset types ' } ) . click ( )
6666
6767 await expect ( page . getByText ( 'No diagnostics yet.' ) ) . toHaveCount ( 2 )
6868 await expect ( diagnosticsToggle ) . toHaveText ( 'Diagnostics' )
@@ -419,9 +419,9 @@ test('clear component diagnostics resets rendered lint-issue status pill', async
419419 )
420420
421421 await ensureDiagnosticsDrawerOpen ( page )
422- await page . getByRole ( 'button' , { name : 'Reset component ' } ) . click ( )
422+ await page . getByRole ( 'button' , { name : 'Reset lint ' } ) . click ( )
423423
424- await expect ( page . getByText ( ' No diagnostics yet.') ) . toHaveCount ( 2 )
424+ await expect ( page . locator ( '#diagnostics-styles' ) ) . toContainText ( ' No diagnostics yet.')
425425 await expect ( diagnosticsToggle ) . toHaveText ( 'Diagnostics' )
426426 await expect ( diagnosticsToggle ) . toHaveClass ( / d i a g n o s t i c s - t o g g l e - - n e u t r a l / )
427427 await expect ( page . getByText ( 'Rendered' , { exact : true } ) ) . toHaveClass ( / s t a t u s - - n e u t r a l / )
@@ -458,7 +458,7 @@ test('component lint ignores only unused App binding', async ({ page }) => {
458458 expect ( diagnosticsText ) . toContain ( 'This function render is unused' )
459459} )
460460
461- test ( 'component lint with unresolved issues enters pending diagnostics state while typing ' , async ( {
461+ test ( 'component lint with unresolved issues becomes stale and waits for manual rerun ' , async ( {
462462 page,
463463} ) => {
464464 await waitForInitialRender ( page )
@@ -481,10 +481,147 @@ test('component lint with unresolved issues enters pending diagnostics state whi
481481 ) ,
482482 )
483483
484- await expect ( diagnosticsToggle ) . toHaveClass ( / d i a g n o s t i c s - t o g g l e - - p e n d i n g / )
485- await expect ( diagnosticsToggle ) . toHaveAttribute ( 'aria-busy' , 'true' )
486-
487- await expect ( page . getByText ( / R e n d e r e d \( L i n t i s s u e s : [ 1 - 9 ] \d * \) / ) ) . toBeVisible ( )
488- await expect ( diagnosticsToggle ) . toHaveClass ( / d i a g n o s t i c s - t o g g l e - - e r r o r / )
484+ await expect ( diagnosticsToggle ) . toHaveClass ( / d i a g n o s t i c s - t o g g l e - - n e u t r a l / )
489485 await expect ( diagnosticsToggle ) . toHaveAttribute ( 'aria-busy' , 'false' )
486+
487+ await ensureDiagnosticsDrawerOpen ( page )
488+ await expect ( page . locator ( '#diagnostics-styles' ) ) . toContainText (
489+ 'Source changed. Click Lint to run diagnostics.' ,
490+ )
491+
492+ await expect ( page . getByText ( 'Rendered' , { exact : true } ) ) . toBeVisible ( )
493+ } )
494+
495+ test ( 'styles active tab shows lint-only diagnostics drawer actions' , async ( { page } ) => {
496+ await waitForInitialRender ( page )
497+
498+ await ensurePanelToolsVisible ( page , 'styles' )
499+ await ensureDiagnosticsDrawerOpen ( page )
500+
501+ await expect ( page . locator ( '[data-diagnostics-scope="component"]' ) ) . toBeHidden ( )
502+ await expect ( page . locator ( '#diagnostics-clear-styles' ) ) . toHaveText ( 'Reset lint' )
503+ await expect ( page . locator ( '#diagnostics-clear-styles' ) ) . toBeVisible ( )
504+ await expect ( page . locator ( '#diagnostics-clear-component' ) ) . toBeHidden ( )
505+ await expect ( page . locator ( '#diagnostics-clear-all' ) ) . toBeHidden ( )
506+ } )
507+
508+ test ( 'component lint completion is ignored after switching to another component tab' , async ( {
509+ page,
510+ } ) => {
511+ await waitForInitialRender ( page )
512+
513+ await ensurePanelToolsVisible ( page , 'component' )
514+ await addWorkspaceTab ( page )
515+
516+ const heavyLintSource = [
517+ ...Array . from ( { length : 120 } , ( _ , index ) => `const unused${ index } = ${ index } ` ) ,
518+ 'const App = () => <button>module tab</button>' ,
519+ ] . join ( '\n' )
520+
521+ await setWorkspaceTabSource ( page , {
522+ fileName : 'module.tsx' ,
523+ kind : 'component' ,
524+ source : heavyLintSource ,
525+ } )
526+
527+ const lintTrigger = page . getByRole ( 'button' , { name : 'Lint' } ) . first ( )
528+ await lintTrigger . click ( )
529+
530+ await setComponentEditorSource (
531+ page ,
532+ 'const App = () => <button type="button">A</button>' ,
533+ )
534+
535+ await expect ( page . locator ( '#diagnostics-styles' ) ) . toContainText (
536+ 'Source changed. Click Lint to run diagnostics.' ,
537+ )
538+ await expect ( page . locator ( '#diagnostics-styles' ) ) . not . toContainText (
539+ 'Biome reported issues.' ,
540+ )
541+ await expect ( page . getByRole ( 'button' , { name : / ^ D i a g n o s t i c s / } ) ) . toHaveClass (
542+ / d i a g n o s t i c s - t o g g l e - - n e u t r a l / ,
543+ )
544+ } )
545+
546+ test ( 'switching tabs clears diagnostics while drawer is open' , async ( { page } ) => {
547+ await waitForInitialRender ( page )
548+
549+ await setComponentEditorSource ( page , 'const App = () => <button>lint me</button>' )
550+ await runComponentLint ( page )
551+
552+ await ensureDiagnosticsDrawerOpen ( page )
553+ await expect ( page . locator ( '#diagnostics-styles' ) ) . toContainText (
554+ 'Biome reported issues.' ,
555+ )
556+
557+ await page . getByRole ( 'button' , { name : 'Open tab app.css' } ) . click ( )
558+
559+ await expect ( page . locator ( '#diagnostics-styles' ) ) . toContainText ( 'No diagnostics yet.' )
560+ await expect ( page . getByRole ( 'button' , { name : / ^ D i a g n o s t i c s / } ) ) . toHaveClass (
561+ / d i a g n o s t i c s - t o g g l e - - n e u t r a l / ,
562+ )
563+ } )
564+
565+ test ( 'same-tab edits with drawer open replace lint issues with stale state' , async ( {
566+ page,
567+ } ) => {
568+ await waitForInitialRender ( page )
569+
570+ await setComponentEditorSource (
571+ page ,
572+ [ 'const count: string = 1' , 'const App = () => <button>Inactive</button>' ] . join ( '\n' ) ,
573+ )
574+
575+ await runTypecheck ( page )
576+ await runComponentLint ( page )
577+ await ensureDiagnosticsDrawerOpen ( page )
578+
579+ await expect ( page . locator ( '#diagnostics-component' ) ) . toContainText ( 'TypeScript found' )
580+ await expect ( page . locator ( '#diagnostics-styles' ) ) . toContainText (
581+ 'Biome reported issues.' ,
582+ )
583+
584+ await setComponentEditorSource (
585+ page ,
586+ [
587+ 'const count: string = "ok"' ,
588+ 'const App = () => <button type="button">Inactive</button>' ,
589+ ] . join ( '\n' ) ,
590+ )
591+
592+ await expect ( page . locator ( '#diagnostics-component' ) ) . not . toContainText ( 'TS2322' )
593+ await expect ( page . locator ( '#diagnostics-styles' ) ) . toContainText (
594+ 'Source changed. Click Lint to run diagnostics.' ,
595+ )
596+ await expect ( page . locator ( '#diagnostics-styles' ) ) . not . toContainText (
597+ 'Biome reported issues.' ,
598+ )
599+ } )
600+
601+ test ( 'reset lint on styles tab clears in-flight component lint state' , async ( {
602+ page,
603+ } ) => {
604+ await waitForInitialRender ( page )
605+
606+ const heavyLintSource = [
607+ ...Array . from ( { length : 120 } , ( _ , index ) => `const unused${ index } = ${ index } ` ) ,
608+ 'const App = () => <button>component tab</button>' ,
609+ ] . join ( '\n' )
610+
611+ await setComponentEditorSource ( page , heavyLintSource )
612+
613+ await ensureDiagnosticsDrawerOpen ( page )
614+ await page . getByRole ( 'button' , { name : 'Lint' } ) . first ( ) . click ( )
615+
616+ await page . getByRole ( 'button' , { name : 'Open tab app.css' } ) . click ( )
617+ await page . locator ( '#diagnostics-clear-styles' ) . click ( )
618+
619+ await expect ( page . getByRole ( 'button' , { name : / ^ D i a g n o s t i c s / } ) ) . toHaveAttribute (
620+ 'aria-busy' ,
621+ 'false' ,
622+ )
623+ await expect ( page . locator ( '#diagnostics-styles' ) ) . toContainText ( 'No diagnostics yet.' )
624+ await expect ( page . locator ( '#diagnostics-styles' ) ) . not . toContainText (
625+ 'Biome reported issues.' ,
626+ )
490627} )
0 commit comments