@@ -27,7 +27,7 @@ describe 'ProjectFindView', ->
27
27
atom .project .setPaths ([path .join (__dirname , ' fixtures' )])
28
28
jasmine .attachToDOM (workspaceElement)
29
29
30
- atom .config .set (' find-and-replace.openProjectFindResultsInRightPane ' , false )
30
+ atom .config .set (' find-and-replace.openProjectFindResultsInANewPane ' , ' no ' )
31
31
activationPromise = atom .packages .activatePackage (" find-and-replace" ).then (options) ->
32
32
mainModule = options .mainModule
33
33
mainModule .createViews ()
@@ -329,9 +329,22 @@ describe 'ProjectFindView', ->
329
329
workspaceElement .style .height = ' 1000px'
330
330
atom .commands .dispatch editorView, ' project-find:show'
331
331
332
- it " splits when option is true " , ->
332
+ it " splits when option is right " , ->
333
333
initialPane = atom .workspace .getActivePane ()
334
- atom .config .set (' find-and-replace.openProjectFindResultsInRightPane' , true )
334
+ atom .config .set (' find-and-replace.openProjectFindResultsInANewPane' , ' right pane' )
335
+ projectFindView .findEditor .setText (' items' )
336
+ atom .commands .dispatch (projectFindView[0 ], ' core:confirm' )
337
+
338
+ waitsForPromise ->
339
+ searchPromise
340
+
341
+ runs ->
342
+ pane1 = atom .workspace .getActivePane ()
343
+ expect (pane1).not .toBe initialPane
344
+
345
+ it " splits when option is bottom" , ->
346
+ initialPane = atom .workspace .getActivePane ()
347
+ atom .config .set (' find-and-replace.openProjectFindResultsInANewPane' , ' bottom pane' )
335
348
projectFindView .findEditor .setText (' items' )
336
349
atom .commands .dispatch (projectFindView[0 ], ' core:confirm' )
337
350
@@ -354,8 +367,8 @@ describe 'ProjectFindView', ->
354
367
pane1 = atom .workspace .getActivePane ()
355
368
expect (pane1).toBe initialPane
356
369
357
- it " can be duplicated" , ->
358
- atom .config .set (' find-and-replace.openProjectFindResultsInRightPane ' , true )
370
+ it " can be duplicated on the right " , ->
371
+ atom .config .set (' find-and-replace.openProjectFindResultsInANewPane ' , ' right pane ' )
359
372
projectFindView .findEditor .setText (' items' )
360
373
atom .commands .dispatch (projectFindView[0 ], ' core:confirm' )
361
374
@@ -379,6 +392,31 @@ describe 'ProjectFindView', ->
379
392
380
393
expect (resultsPaneView2 .querySelector (' .preview-count' ).innerHTML ).toEqual resultsPaneView1 .querySelector (' .preview-count' ).innerHTML
381
394
395
+ it " can be duplicated at the bottom" , ->
396
+ atom .config .set (' find-and-replace.openProjectFindResultsInANewPane' , ' bottom pane' )
397
+ projectFindView .findEditor .setText (' items' )
398
+ atom .commands .dispatch (projectFindView[0 ], ' core:confirm' )
399
+
400
+ waitsForPromise ->
401
+ searchPromise
402
+
403
+ runs ->
404
+ resultsPaneView1 = atom .views .getView (getExistingResultsPane ())
405
+ pane1 = atom .workspace .getActivePane ()
406
+ pane1 .splitDown (copyActiveItem : true )
407
+
408
+ pane2 = atom .workspace .getActivePane ()
409
+ resultsPaneView2 = atom .views .getView (pane2 .itemForURI (ResultsPaneView .URI ))
410
+
411
+ expect (pane1).not .toBe pane2
412
+ expect (resultsPaneView1).not .toBe resultsPaneView2
413
+
414
+ length = resultsPaneView1 .querySelectorAll (' li > ul > li' ).length
415
+ expect (length).toBeGreaterThan 0
416
+ expect (resultsPaneView2 .querySelectorAll (' li > ul > li' )).toHaveLength length
417
+
418
+ expect (resultsPaneView2 .querySelector (' .preview-count' ).innerHTML ).toEqual resultsPaneView1 .querySelector (' .preview-count' ).innerHTML
419
+
382
420
describe " serialization" , ->
383
421
it " serializes if the case, regex and whole word options" , ->
384
422
atom .commands .dispatch editorView, ' project-find:show'
@@ -1375,9 +1413,9 @@ describe 'ProjectFindView', ->
1375
1413
expect (projectFindView .pathsEditor ).not .toHaveClass (' is-focused' )
1376
1414
1377
1415
describe " panel opening" , ->
1378
- describe " when a panel is already open" , ->
1416
+ describe " when a panel is already open on the right " , ->
1379
1417
beforeEach ->
1380
- atom .config .set (' find-and-replace.openProjectFindResultsInRightPane ' , true )
1418
+ atom .config .set (' find-and-replace.openProjectFindResultsInANewPane ' , ' right pane ' )
1381
1419
1382
1420
waitsForPromise ->
1383
1421
atom .workspace .open (' sample.js' )
@@ -1408,6 +1446,39 @@ describe 'ProjectFindView', ->
1408
1446
runs ->
1409
1447
expect (workspaceElement .querySelectorAll (' .preview-pane' ).length ).toBe (1 )
1410
1448
1449
+ describe " when a panel is already open at the bottom" , ->
1450
+ beforeEach ->
1451
+ atom .config .set (' find-and-replace.openProjectFindResultsInANewPane' , ' bottom pane' )
1452
+
1453
+ waitsForPromise ->
1454
+ atom .workspace .open (' sample.js' )
1455
+
1456
+ runs ->
1457
+ editor = atom .workspace .getActiveTextEditor ()
1458
+ editorView = atom .views .getView (editor)
1459
+ atom .commands .dispatch (workspaceElement, ' project-find:show' )
1460
+
1461
+ waitsForPromise ->
1462
+ activationPromise
1463
+
1464
+ runs ->
1465
+ projectFindView .findEditor .setText (' items' )
1466
+ atom .commands .dispatch (projectFindView[0 ], ' core:confirm' )
1467
+
1468
+ waitsForPromise ->
1469
+ searchPromise
1470
+
1471
+ it " doesn't open another panel even if the active pane is horizontally split" , ->
1472
+ atom .commands .dispatch (editorView, ' pane:split-right' )
1473
+ projectFindView .findEditor .setText (' items' )
1474
+ atom .commands .dispatch (projectFindView[0 ], ' core:confirm' )
1475
+
1476
+ waitsForPromise ->
1477
+ searchPromise
1478
+
1479
+ runs ->
1480
+ expect (workspaceElement .querySelectorAll (' .preview-pane' ).length ).toBe (1 )
1481
+
1411
1482
describe " when language-javascript is active" , ->
1412
1483
beforeEach ->
1413
1484
waitsForPromise ->
0 commit comments