@@ -24,7 +24,7 @@ import { OpenEditorsSection } from "./open-editors-section";
2424vi . mock ( "../../../../lib/i18n" , ( ) => ( {
2525 useTranslation : ( ) => ( key : string , params ?: Record < string , string | number > ) => {
2626 if ( key === "common.cancel" ) return "Cancel" ;
27- if ( key === "workspace.sidebar.open_editors" ) return "Open Editors " ;
27+ if ( key === "workspace.sidebar.open_editors" ) return "Open Files " ;
2828 if ( key === "action.close" ) return "Close" ;
2929 if ( key === "action.close_all" ) return "Close all" ;
3030 if ( key === "code_editor.unsaved_changes" ) return "Unsaved changes" ;
@@ -34,13 +34,13 @@ vi.mock("../../../../lib/i18n", () => ({
3434 }
3535 if ( key === "code_editor.discard_and_close" ) return "Discard and Close" ;
3636 if ( key === "workspace.open_editors.close_all_unsaved_description" ) {
37- return `${ params ?. count ?? 0 } open editors have unsaved changes.` ;
37+ return `${ params ?. count ?? 0 } open files have unsaved changes.` ;
3838 }
3939 if ( key === "workspace.open_editors.title_with_count" ) {
40- return `${ params ?. title ?? "Open Editors " } (${ params ?. count ?? 0 } )` ;
40+ return `${ params ?. title ?? "Open Files " } (${ params ?. count ?? 0 } )` ;
4141 }
42- if ( key === "workspace.open_editors.expand_label" ) return "Expand Open Editors " ;
43- if ( key === "workspace.open_editors.collapse_label" ) return "Collapse Open Editors " ;
42+ if ( key === "workspace.open_editors.expand_label" ) return "Expand Open Files " ;
43+ if ( key === "workspace.open_editors.collapse_label" ) return "Collapse Open Files " ;
4444 if ( key === "workspace.open_editors.close_path" ) {
4545 return `Close ${ params ?. path ?? "" } ` ;
4646 }
@@ -113,12 +113,12 @@ describe("OpenEditorsSection", () => {
113113 it ( "shows file count, toggles collapse, closes a non-active row, and closes all" , ( ) => {
114114 const { store } = renderSection ( ) ;
115115
116- const heading = screen . getByRole ( "heading" , { level : 2 , name : "Open Editors (3)" } ) ;
117- expect ( heading ) . toHaveTextContent ( "Open Editors " ) ;
116+ const heading = screen . getByRole ( "heading" , { level : 2 , name : "Open Files (3)" } ) ;
117+ expect ( heading ) . toHaveTextContent ( "Open Files " ) ;
118118
119119 const section = heading . closest ( "section" ) as HTMLElement ;
120120 expect ( within ( section ) . getByText ( "3" ) ) . toHaveClass ( "workspace-open-editors__count" ) ;
121- const toggle = within ( section ) . getByRole ( "button" , { name : / c o l l a p s e o p e n e d i t o r s / i } ) ;
121+ const toggle = within ( section ) . getByRole ( "button" , { name : / c o l l a p s e o p e n f i l e s / i } ) ;
122122
123123 expect ( toggle ) . toHaveAttribute ( "aria-expanded" , "true" ) ;
124124
@@ -142,7 +142,7 @@ describe("OpenEditorsSection", () => {
142142 ] ) ;
143143
144144 fireEvent . click ( toggle ) ;
145- expect ( within ( section ) . getByRole ( "button" , { name : "Expand Open Editors " } ) ) . toHaveAttribute (
145+ expect ( within ( section ) . getByRole ( "button" , { name : "Expand Open Files " } ) ) . toHaveAttribute (
146146 "aria-expanded" ,
147147 "false"
148148 ) ;
@@ -152,7 +152,7 @@ describe("OpenEditorsSection", () => {
152152 } )
153153 ) . toBeNull ( ) ;
154154
155- fireEvent . click ( within ( section ) . getByRole ( "button" , { name : / e x p a n d o p e n e d i t o r s / i } ) ) ;
155+ fireEvent . click ( within ( section ) . getByRole ( "button" , { name : / e x p a n d o p e n f i l e s / i } ) ) ;
156156
157157 const readmeRow = within ( section )
158158 . getByRole ( "button" , { name : "README.md" } )
@@ -165,21 +165,25 @@ describe("OpenEditorsSection", () => {
165165 ] ) ;
166166 expect ( store . get ( activeFilePathAtomFamily ( "ws-test" ) ) ) . toBe ( "src/beta.ts" ) ;
167167
168- fireEvent . click ( within ( section ) . getByRole ( "button" , { name : "Close all" } ) ) ;
168+ const closeAllButton = within ( section ) . getByRole ( "button" , { name : "Close all" } ) ;
169+ expect ( closeAllButton ) . toHaveTextContent ( / ^ $ / ) ;
170+ expect ( closeAllButton . querySelector ( "svg" ) ) . toBeTruthy ( ) ;
171+
172+ fireEvent . click ( closeAllButton ) ;
169173
170174 expect ( store . get ( openFilesAtomFamily ( "ws-test" ) ) ) . toEqual ( { } ) ;
171175 expect ( store . get ( activeFilePathAtomFamily ( "ws-test" ) ) ) . toBeNull ( ) ;
172176 } ) ;
173177
174- it ( "keeps the header visible but hides the body when there are no open editors " , ( ) => {
178+ it ( "keeps the header visible but hides the body when there are no open files " , ( ) => {
175179 renderSection ( { } ) ;
176180
177- const heading = screen . getByRole ( "heading" , { level : 2 , name : "Open Editors (0)" } ) ;
178- expect ( heading ) . toHaveTextContent ( "Open Editors " ) ;
181+ const heading = screen . getByRole ( "heading" , { level : 2 , name : "Open Files (0)" } ) ;
182+ expect ( heading ) . toHaveTextContent ( "Open Files " ) ;
179183
180184 const section = heading . closest ( "section" ) as HTMLElement ;
181185 expect ( within ( section ) . getByText ( "0" ) ) . toHaveClass ( "workspace-open-editors__count" ) ;
182- const toggle = within ( section ) . getByRole ( "button" , { name : "Expand Open Editors " } ) ;
186+ const toggle = within ( section ) . getByRole ( "button" , { name : "Expand Open Files " } ) ;
183187
184188 expect ( toggle ) . toBeDisabled ( ) ;
185189 expect ( toggle ) . not . toHaveAttribute ( "aria-expanded" ) ;
@@ -194,13 +198,13 @@ describe("OpenEditorsSection", () => {
194198
195199 renderSection ( { } , "src/pending.ts" ) ;
196200
197- const heading = screen . getByRole ( "heading" , { level : 2 , name : "Open Editors (1)" } ) ;
198- expect ( heading ) . toHaveTextContent ( "Open Editors " ) ;
201+ const heading = screen . getByRole ( "heading" , { level : 2 , name : "Open Files (1)" } ) ;
202+ expect ( heading ) . toHaveTextContent ( "Open Files " ) ;
199203
200204 const section = heading . closest ( "section" ) as HTMLElement ;
201205 expect ( within ( section ) . getByText ( "1" ) ) . toHaveClass ( "workspace-open-editors__count" ) ;
202206
203- expect ( within ( section ) . getByRole ( "button" , { name : "Collapse Open Editors " } ) ) . toHaveAttribute (
207+ expect ( within ( section ) . getByRole ( "button" , { name : "Collapse Open Files " } ) ) . toHaveAttribute (
204208 "aria-expanded" ,
205209 "true"
206210 ) ;
@@ -215,7 +219,7 @@ describe("OpenEditorsSection", () => {
215219 draftStore . set ( openEditorPathsAtomFamily ( "ws-test" ) , [ "src/app.tsx" , "README.md" ] ) ;
216220 } ) ;
217221
218- const heading = screen . getByRole ( "heading" , { level : 2 , name : "Open Editors (2)" } ) ;
222+ const heading = screen . getByRole ( "heading" , { level : 2 , name : "Open Files (2)" } ) ;
219223 const section = heading . closest ( "section" ) as HTMLElement ;
220224 const rowButtons = Array . from (
221225 section . querySelectorAll < HTMLButtonElement > ( ".workspace-open-editors__item" )
@@ -254,7 +258,7 @@ describe("OpenEditorsSection", () => {
254258 expect ( store . get ( activeFilePathAtomFamily ( "ws-test" ) ) ) . toBe ( "README.md" ) ;
255259 } ) ;
256260
257- it ( "marks dirty open editors and confirms before closing a dirty row" , ( ) => {
261+ it ( "marks dirty open files and confirms before closing a dirty row" , ( ) => {
258262 const { store } = renderSection (
259263 {
260264 "biome.jsonc" : createDirtyFile ( "biome.jsonc" ) ,
@@ -283,7 +287,7 @@ describe("OpenEditorsSection", () => {
283287 expect ( store . get ( activeFilePathAtomFamily ( "ws-test" ) ) ) . toBeNull ( ) ;
284288 } ) ;
285289
286- it ( "confirms before closing all when open editors include dirty files" , ( ) => {
290+ it ( "confirms before closing all when open files include dirty files" , ( ) => {
287291 const { store } = renderSection (
288292 {
289293 "src/clean.ts" : createFile ( "src/clean.ts" ) ,
@@ -299,7 +303,7 @@ describe("OpenEditorsSection", () => {
299303 "src/dirty.ts" ,
300304 ] ) ;
301305 expect ( screen . getByRole ( "dialog" , { name : "Discard unsaved changes?" } ) ) . toBeInTheDocument ( ) ;
302- expect ( screen . getByText ( "1 open editors have unsaved changes." ) ) . toBeInTheDocument ( ) ;
306+ expect ( screen . getByText ( "1 open files have unsaved changes." ) ) . toBeInTheDocument ( ) ;
303307
304308 fireEvent . click ( screen . getByRole ( "button" , { name : "Discard and Close" } ) ) ;
305309
0 commit comments