@@ -59,10 +59,10 @@ describe('editorActions', () => {
5959 expect ( rightPaneActiveEditorId . current ) . toBeNull ( ) ;
6060 } ) ;
6161
62- it ( 'should open TXT file in the left pane, and be active' , ( ) => {
62+ it ( 'should open REFSTUDIO file in the left pane, and be active' , ( ) => {
6363 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
6464
65- const { fileEntry : fileToOpen , editorData } = makeFileAndEditor ( 'file.txt ' ) ;
65+ const { fileEntry : fileToOpen , editorData } = makeFileAndEditor ( 'file.refstudio ' ) ;
6666 expect ( leftPaneOpenEditorsCount . current ) . toBe ( 0 ) ;
6767 expect ( leftPaneActiveEditorId . current ) . toBeNull ( ) ;
6868
@@ -74,10 +74,38 @@ describe('editorActions', () => {
7474 expect ( leftPaneActiveEditorId . current ) . toBe ( editorData . id ) ;
7575 } ) ;
7676
77- it ( 'should open TXT filePath in the left pane, and be active' , ( ) => {
77+ it ( 'should open REFSTUDIO filePath in the left pane, and be active' , ( ) => {
7878 const openFile = runSetAtomHook ( openFilePathAtom , store ) ;
7979
80- const filePath = '/some/absolute/path/file.txt' ;
80+ const filePath = '/some/absolute/path/file.refstudio' ;
81+ act ( ( ) => openFile . current ( filePath ) ) ;
82+
83+ expect ( store . get ( activePaneIdAtom ) ) . toBe < PaneId > ( 'LEFT' ) ;
84+ expect ( leftPaneOpenEditorsCount . current ) . toBe ( 1 ) ;
85+
86+ const editorId = buildEditorId ( 'refstudio' , filePath ) ;
87+ expect ( leftPaneActiveEditorId . current ) . toBe ( editorId ) ;
88+ } ) ;
89+
90+ it ( 'should open file with no extension in the left pane, and be active' , ( ) => {
91+ const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
92+
93+ const { fileEntry : fileToOpen , editorData } = makeFileAndEditor ( 'file' ) ;
94+ expect ( leftPaneOpenEditorsCount . current ) . toBe ( 0 ) ;
95+ expect ( leftPaneActiveEditorId . current ) . toBeNull ( ) ;
96+
97+ act ( ( ) => openFile . current ( fileToOpen ) ) ;
98+
99+ expect ( store . get ( activePaneIdAtom ) ) . toBe < PaneId > ( 'LEFT' ) ;
100+ expect ( leftPaneOpenEditorsCount . current ) . toBe ( 1 ) ;
101+ expect ( leftPaneOpenEditorsData . current [ 0 ] ) . toStrictEqual ( editorData ) ;
102+ expect ( leftPaneActiveEditorId . current ) . toBe ( editorData . id ) ;
103+ } ) ;
104+
105+ it ( 'should open filePath with no extension in the left pane, and be active' , ( ) => {
106+ const openFile = runSetAtomHook ( openFilePathAtom , store ) ;
107+
108+ const filePath = '/some/absolute/path/file' ;
81109 act ( ( ) => openFile . current ( filePath ) ) ;
82110
83111 expect ( store . get ( activePaneIdAtom ) ) . toBe < PaneId > ( 'LEFT' ) ;
@@ -105,7 +133,7 @@ describe('editorActions', () => {
105133 it ( 'should open file once in same panel' , ( ) => {
106134 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
107135
108- const { fileEntry : fileToOpen } = makeFileAndEditor ( 'file.txt ' ) ;
136+ const { fileEntry : fileToOpen } = makeFileAndEditor ( 'file.refstudio ' ) ;
109137 expect ( leftPaneOpenEditorsCount . current ) . toBe ( 0 ) ;
110138
111139 act ( ( ) => {
@@ -149,8 +177,8 @@ describe('editorActions', () => {
149177 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
150178 const closeFileFromPane = runSetAtomHook ( closeEditorFromPaneAtom , store ) ;
151179
152- const { fileEntry : fileA , editorData : editorDataA } = makeFileAndEditor ( 'fileA.txt ' ) ;
153- const { fileEntry : fileB } = makeFileAndEditor ( 'fileB.txt ' ) ;
180+ const { fileEntry : fileA , editorData : editorDataA } = makeFileAndEditor ( 'fileA.refstudio ' ) ;
181+ const { fileEntry : fileB } = makeFileAndEditor ( 'fileB.refstudio ' ) ;
154182
155183 act ( ( ) => {
156184 openFile . current ( fileA ) ;
@@ -169,7 +197,7 @@ describe('editorActions', () => {
169197 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
170198 const closeEditorFromAllPanes = runSetAtomHook ( closeEditorFromAllPanesAtom , store ) ;
171199
172- const { fileEntry : fileA , editorData : editorDataA } = makeFileAndEditor ( 'fileA.txt ' ) ;
200+ const { fileEntry : fileA , editorData : editorDataA } = makeFileAndEditor ( 'fileA.refstudio ' ) ;
173201 const { fileEntry : fileB , editorData : editorDataB } = makeFileAndEditor ( 'fileB.pdf' ) ;
174202
175203 act ( ( ) => {
@@ -192,8 +220,8 @@ describe('editorActions', () => {
192220 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
193221 const closeFileFromPane = runSetAtomHook ( closeEditorFromPaneAtom , store ) ;
194222
195- const { fileEntry : fileOpened , editorData : openedEditorData } = makeFileAndEditor ( 'fileA.txt ' ) ;
196- const { editorData : notOpenedEditorData } = makeFileAndEditor ( 'fileB.txt ' ) ;
223+ const { fileEntry : fileOpened , editorData : openedEditorData } = makeFileAndEditor ( 'fileA.refstudio ' ) ;
224+ const { editorData : notOpenedEditorData } = makeFileAndEditor ( 'fileB.refstudio ' ) ;
197225
198226 act ( ( ) => {
199227 openFile . current ( fileOpened ) ;
@@ -213,7 +241,7 @@ describe('editorActions', () => {
213241 it ( 'should not fail trying to select file that is not opened in pane' , ( ) => {
214242 const selectFileInPane = runSetAtomHook ( selectEditorInPaneAtom , store ) ;
215243
216- const { editorData } = makeFileAndEditor ( 'fileA.txt ' ) ;
244+ const { editorData } = makeFileAndEditor ( 'fileA.refstudio ' ) ;
217245
218246 act ( ( ) => {
219247 selectFileInPane . current ( { paneId : 'LEFT' , editorId : editorData . id } ) ;
@@ -251,7 +279,7 @@ describe('editorActions', () => {
251279 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
252280 const closeAllFiles = runSetAtomHook ( closeAllEditorsAtom , store ) ;
253281
254- const { fileEntry : fileA , editorData : fileAData } = makeFileAndEditor ( 'file.txt ' ) ;
282+ const { fileEntry : fileA , editorData : fileAData } = makeFileAndEditor ( 'file.refstudio ' ) ;
255283 const { fileEntry : fileB , editorData : fileBData } = makeFileAndEditor ( 'file.pdf' ) ;
256284
257285 act ( ( ) => {
@@ -273,7 +301,7 @@ describe('editorActions', () => {
273301 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
274302 const moveEditorToPane = runSetAtomHook ( moveEditorToPaneAtom , store ) ;
275303
276- const { fileEntry, editorData } = makeFileAndEditor ( 'file.txt ' ) ;
304+ const { fileEntry, editorData } = makeFileAndEditor ( 'file.refstudio ' ) ;
277305
278306 act ( ( ) => {
279307 openFile . current ( fileEntry ) ;
@@ -294,7 +322,7 @@ describe('editorActions', () => {
294322 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
295323 const moveEditorToPane = runSetAtomHook ( moveEditorToPaneAtom , store ) ;
296324
297- const { fileEntry : fileA , editorData } = makeFileAndEditor ( 'file.txt ' ) ;
325+ const { fileEntry : fileA , editorData } = makeFileAndEditor ( 'file.refstudio ' ) ;
298326
299327 act ( ( ) => {
300328 openFile . current ( fileA ) ;
@@ -315,8 +343,8 @@ describe('editorActions', () => {
315343 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
316344 const moveEditorToPane = runSetAtomHook ( moveEditorToPaneAtom , store ) ;
317345
318- const { fileEntry : fileA , editorData : fileAData } = makeFileAndEditor ( 'file1.txt ' ) ;
319- const { fileEntry : fileB , editorData : fileBData } = makeFileAndEditor ( 'file2.txt ' ) ;
346+ const { fileEntry : fileA , editorData : fileAData } = makeFileAndEditor ( 'file1.refstudio ' ) ;
347+ const { fileEntry : fileB , editorData : fileBData } = makeFileAndEditor ( 'file2.refstudio ' ) ;
320348
321349 act ( ( ) => {
322350 openFile . current ( fileA ) ;
@@ -342,7 +370,7 @@ describe('editorActions', () => {
342370 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
343371 const moveEditorToPane = runSetAtomHook ( moveEditorToPaneAtom , store ) ;
344372
345- const { fileEntry : fileA , editorData } = makeFileAndEditor ( 'file.txt ' ) ;
373+ const { fileEntry : fileA , editorData } = makeFileAndEditor ( 'file.refstudio ' ) ;
346374
347375 act ( ( ) => {
348376 openFile . current ( fileA ) ;
@@ -363,9 +391,9 @@ describe('editorActions', () => {
363391 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
364392 const closeFileFromPane = runSetAtomHook ( closeEditorFromPaneAtom , store ) ;
365393
366- const { fileEntry : fileA } = makeFileAndEditor ( 'fileA.txt ' ) ;
367- const { fileEntry : fileB , editorData : editorDataB } = makeFileAndEditor ( 'fileB.txt ' ) ;
368- const { fileEntry : fileC , editorData : editorDataC } = makeFileAndEditor ( 'fileC.txt ' ) ;
394+ const { fileEntry : fileA } = makeFileAndEditor ( 'fileA.refstudio ' ) ;
395+ const { fileEntry : fileB , editorData : editorDataB } = makeFileAndEditor ( 'fileB.refstudio ' ) ;
396+ const { fileEntry : fileC , editorData : editorDataC } = makeFileAndEditor ( 'fileC.refstudio ' ) ;
369397
370398 act ( ( ) => {
371399 openFile . current ( fileA ) ;
@@ -386,9 +414,9 @@ describe('editorActions', () => {
386414 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
387415 const closeFileFromPane = runSetAtomHook ( closeEditorFromPaneAtom , store ) ;
388416
389- const { fileEntry : fileA } = makeFileAndEditor ( 'fileA.txt ' ) ;
390- const { fileEntry : fileB , editorData : editorDataB } = makeFileAndEditor ( 'fileB.txt ' ) ;
391- const { fileEntry : fileC , editorData : editorDataC } = makeFileAndEditor ( 'fileC.txt ' ) ;
417+ const { fileEntry : fileA } = makeFileAndEditor ( 'fileA.refstudio ' ) ;
418+ const { fileEntry : fileB , editorData : editorDataB } = makeFileAndEditor ( 'fileB.refstudio ' ) ;
419+ const { fileEntry : fileC , editorData : editorDataC } = makeFileAndEditor ( 'fileC.refstudio ' ) ;
392420
393421 act ( ( ) => {
394422 openFile . current ( fileA ) ;
@@ -409,8 +437,8 @@ describe('editorActions', () => {
409437 const openFile = runSetAtomHook ( openFileEntryAtom , store ) ;
410438 const closeFileFromPane = runSetAtomHook ( closeEditorFromPaneAtom , store ) ;
411439
412- const { fileEntry : fileA , editorData : editorDataA } = makeFileAndEditor ( 'fileA.txt ' ) ;
413- const { fileEntry : fileB , editorData : editorDataB } = makeFileAndEditor ( 'fileB.txt ' ) ;
440+ const { fileEntry : fileA , editorData : editorDataA } = makeFileAndEditor ( 'fileA.refstudio ' ) ;
441+ const { fileEntry : fileB , editorData : editorDataB } = makeFileAndEditor ( 'fileB.refstudio ' ) ;
414442
415443 act ( ( ) => {
416444 openFile . current ( fileA ) ;
@@ -447,7 +475,7 @@ describe('editorActions', () => {
447475 jsonContent : { doc : 'some content' } ,
448476 } ) ;
449477
450- const { fileEntry : fileA } = makeFileAndEditor ( 'fileA.txt ' ) ;
478+ const { fileEntry : fileA } = makeFileAndEditor ( 'fileA.refstudio ' ) ;
451479
452480 act ( ( ) => {
453481 openFile . current ( fileA ) ;
0 commit comments