Wait for editors to open in ResultsView spec
MODIFY
lib/project/results-view.js
lib/project/results-view.js
@@ -390,7 +390,7 @@ class ResultsView {
const result = this.model.getResultAt(this.selectedResultIndex);
if (result) {
const match = result.matches[this.selectedMatchIndex];
- atom.workspace
+ return atom.workspace
.open(result.filePath, {
pending,
split: reverseDirections[atom.config.get('find-and-replace.projectSearchResultsPaneSplitDirection')]

MODIFY
spec/results-view-spec.js
spec/results-view-spec.js
@@ -424,41 +424,32 @@ describe('ResultsView', () => {
expect(atom.views.getView(editor)).toHaveFocus();
})
- describe("when `projectSearchResultsPaneSplitDirection` option is none", () => {
+ describe("the `projectSearchResultsPaneSplitDirection` option", () => {
beforeEach(() => {
- atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'none');
+ spyOn(atom.workspace, 'open').andCallThrough()
});
- it("does not specify a pane to split", () => {
- spyOn(atom.workspace, 'open').andCallThrough();
+ it("does not create a split when the option is 'none'", async () => {
+ atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'none');
atom.commands.dispatch(resultsView.element, 'core:move-down');
atom.commands.dispatch(resultsView.element, 'core:confirm');
+ await paneItemOpening()
expect(atom.workspace.open.mostRecentCall.args[1].split).toBeUndefined();
});
- });
- describe("when `projectSearchResultsPaneSplitDirection` option is right", () => {
- beforeEach(() => {
+ it("always opens the file in the left pane when the option is 'right'", async () => {
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'right');
- });
-
- it("always opens the file in the left pane", () => {
- spyOn(atom.workspace, 'open').andCallThrough();
atom.commands.dispatch(resultsView.element, 'core:move-down');
atom.commands.dispatch(resultsView.element, 'core:confirm');
+ await paneItemOpening()
expect(atom.workspace.open.mostRecentCall.args[1].split).toBe('left');
});
- });
- describe("when `projectSearchResultsPaneSplitDirection` option is down", () => {
- beforeEach(() => {
+ it("always opens the file in the pane above when the options is 'down'", async () => {
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'down')
- });
-
- it("always opens the file in the up pane", () => {
- spyOn(atom.workspace, 'open').andCallThrough();
atom.commands.dispatch(resultsView.element, 'core:move-down');
atom.commands.dispatch(resultsView.element, 'core:confirm');
+ await paneItemOpening()
expect(atom.workspace.open.mostRecentCall.args[1].split).toBe('up');
});
});

Wait for editors to open in ResultsView spec