add comment for incorrect version comparison
MODIFY
lib/project/results-model.coffee
lib/project/results-model.coffee
@@ -247,6 +247,8 @@ class ResultsModel
return unless editor.getPath()
matches = []
+ # the following condition is pretty hacky
+ # it doesn't work correctly for e.g. version 1.2
if parseFloat(atom.getVersion()) >= 1.17
leadingContextLineCount = atom.config.get('find-and-replace.searchContextLineCountBefore')
trailingContextLineCount = atom.config.get('find-and-replace.searchContextLineCountAfter')

MODIFY
spec/results-model-spec.js
spec/results-model-spec.js
@@ -35,6 +35,8 @@ describe("ResultsModel", () => {
expect(resultsModel.getPathCount()).toBe(1);
expect(resultsModel.getMatchCount()).toBe(6);
expect(resultsModel.getPaths()).toEqual([editor.getPath()]);
+ // the following condition is pretty hacky
+ // it doesn't work correctly for e.g. version 1.2
if (parseFloat(atom.getVersion()) >= 1.17) {
expect(result.matches[0].leadingContextLines.length).toBe(1);
expect(result.matches[0].leadingContextLines[0]).toBe("var quicksort = function () {");
@@ -56,6 +58,8 @@ describe("ResultsModel", () => {
expect(resultsModel.getMatchCount()).toBe(1);
expect(resultsModel.getPaths()).toEqual([editor.getPath()]);
expect(result.matches[0].lineText).toBe("there are some items in here");
+ // the following condition is pretty hacky
+ // it doesn't work correctly for e.g. version 1.2
if (parseFloat(atom.getVersion()) >= 1.17) {
expect(result.matches[0].leadingContextLines.length).toBe(0);
expect(result.matches[0].trailingContextLines.length).toBe(0);

MODIFY
spec/results-view-spec.js
spec/results-view-spec.js
@@ -716,6 +716,8 @@ describe('ResultsView', () => {
});
it('shows the context lines', async () => {
+ // the following condition is pretty hacky
+ // it doesn't work correctly for e.g. version 1.2
if (parseFloat(atom.getVersion()) >= 1.17) {
const pathNodes = resultsView.refs.listView.element.querySelectorAll('.path');
expect(pathNodes.length).toBe(1)

add comment for incorrect version comparison