@@ -26,16 +26,20 @@ afterEach(() => {
2626} ) ;
2727
2828describe ( "DemoSection" , ( ) => {
29- it ( "renders three tabs with CLI selected by default" , ( ) => {
29+ it ( "renders three tabs with Agent selected by default" , ( ) => {
3030 render ( < DemoSection /> ) ;
3131 const tabs = screen . getAllByRole ( "tab" ) ;
32- expect ( tabs . map ( ( t ) => t . textContent ) ) . toEqual ( [ "CLI " , "Viewer" , "Agent " ] ) ;
33- expect ( screen . getByRole ( "tab" , { name : "CLI " } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
32+ expect ( tabs . map ( ( t ) => t . textContent ) ) . toEqual ( [ "Agent " , "Viewer" , "CLI " ] ) ;
33+ expect ( screen . getByRole ( "tab" , { name : "Agent " } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
3434 } ) ;
3535
36- it ( "shows the terminal player on the default tab" , ( ) => {
36+ it ( "plays the agent video with a stop control on the default tab" , ( ) => {
3737 render ( < DemoSection /> ) ;
38- expect ( screen . getByTestId ( "demo-hero-player" ) ) . toBeInTheDocument ( ) ;
38+ const video = screen . getByTestId ( "demo-agent-media" ) ;
39+ expect ( video ) . toBeInTheDocument ( ) ;
40+ // Direct mapping: a light page shows the light-named asset.
41+ expect ( video ) . toHaveAttribute ( "src" , "/agent-video-light.mp4" ) ;
42+ expect ( screen . getByRole ( "button" , { name : / p a u s e d e m o / i } ) ) . toBeInTheDocument ( ) ;
3943 expect ( screen . queryByTestId ( "demo-viewer-media" ) ) . not . toBeInTheDocument ( ) ;
4044 } ) ;
4145
@@ -48,37 +52,35 @@ describe("DemoSection", () => {
4852 expect ( media . closest ( "a" ) ) . toHaveAttribute ( "href" , "https://viewer.opentaint.org/" ) ;
4953 } ) ;
5054
51- it ( "switches to the agent slide and plays the agent video with a stop control " , ( ) => {
55+ it ( "switches to the CLI slide and shows the terminal player " , ( ) => {
5256 render ( < DemoSection /> ) ;
53- fireEvent . click ( screen . getByRole ( "tab" , { name : "Agent" } ) ) ;
54- const video = screen . getByTestId ( "demo-agent-media" ) ;
55- expect ( video ) . toBeInTheDocument ( ) ;
56- // Direct mapping: a light page shows the light-named asset.
57- expect ( video ) . toHaveAttribute ( "src" , "/agent-video-light.mp4" ) ;
58- expect ( screen . getByRole ( "button" , { name : / p a u s e d e m o / i } ) ) . toBeInTheDocument ( ) ;
57+ fireEvent . click ( screen . getByRole ( "tab" , { name : "CLI" } ) ) ;
58+ expect ( screen . getByRole ( "tab" , { name : "CLI" } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
59+ expect ( screen . getByTestId ( "demo-hero-player" ) ) . toBeInTheDocument ( ) ;
60+ expect ( screen . queryByTestId ( "demo-agent-media" ) ) . not . toBeInTheDocument ( ) ;
5961 } ) ;
6062
6163 it ( "moves between tabs with the right arrow key" , ( ) => {
6264 render ( < DemoSection /> ) ;
63- const cliTab = screen . getByRole ( "tab" , { name : "CLI " } ) ;
64- cliTab . focus ( ) ;
65- fireEvent . keyDown ( cliTab , { key : "ArrowRight" } ) ;
65+ const agentTab = screen . getByRole ( "tab" , { name : "Agent " } ) ;
66+ agentTab . focus ( ) ;
67+ fireEvent . keyDown ( agentTab , { key : "ArrowRight" } ) ;
6668 expect ( screen . getByRole ( "tab" , { name : "Viewer" } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
6769 } ) ;
6870
6971 it ( "wraps to the last tab when ArrowLeft is pressed on the first tab" , ( ) => {
7072 render ( < DemoSection /> ) ;
71- const cliTab = screen . getByRole ( "tab" , { name : "CLI " } ) ;
72- cliTab . focus ( ) ;
73- fireEvent . keyDown ( cliTab , { key : "ArrowLeft" } ) ;
74- expect ( screen . getByRole ( "tab" , { name : "Agent " } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
73+ const agentTab = screen . getByRole ( "tab" , { name : "Agent " } ) ;
74+ agentTab . focus ( ) ;
75+ fireEvent . keyDown ( agentTab , { key : "ArrowLeft" } ) ;
76+ expect ( screen . getByRole ( "tab" , { name : "CLI " } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
7577 } ) ;
7678
7779 it ( "moves DOM focus to the newly active tab on arrow navigation" , ( ) => {
7880 render ( < DemoSection /> ) ;
79- const cliTab = screen . getByRole ( "tab" , { name : "CLI " } ) ;
80- cliTab . focus ( ) ;
81- fireEvent . keyDown ( cliTab , { key : "ArrowRight" } ) ;
81+ const agentTab = screen . getByRole ( "tab" , { name : "Agent " } ) ;
82+ agentTab . focus ( ) ;
83+ fireEvent . keyDown ( agentTab , { key : "ArrowRight" } ) ;
8284 expect ( screen . getByRole ( "tab" , { name : "Viewer" } ) ) . toHaveFocus ( ) ;
8385 } ) ;
8486
@@ -136,11 +138,11 @@ describe("DemoSection", () => {
136138 vi . useFakeTimers ( ) ;
137139 try {
138140 render ( < DemoSection /> ) ;
139- fireEvent . click ( screen . getByRole ( "tab" , { name : "Agent " } ) ) ;
141+ fireEvent . click ( screen . getByRole ( "tab" , { name : "CLI " } ) ) ;
140142 act ( ( ) => {
141143 vi . advanceTimersByTime ( 21000 ) ;
142144 } ) ;
143- expect ( screen . getByRole ( "tab" , { name : "Agent " } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
145+ expect ( screen . getByRole ( "tab" , { name : "CLI " } ) ) . toHaveAttribute ( "aria-selected" , "true" ) ;
144146 } finally {
145147 vi . useRealTimers ( ) ;
146148 }
0 commit comments