Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 53db29a

Browse files
committed
Add a spec
1 parent f1aa436 commit 53db29a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/buffer-search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class BufferSearch {
239239
}
240240
}
241241

242-
this.emitter.emit('did-update', this.markers.slice());
242+
if(changes.length) this.emitter.emit('did-update', this.markers.slice());
243243
this.currentResultMarker = null;
244244
this.setCurrentMarkerFromSelection();
245245
}

spec/find-view-spec.coffee

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,18 @@ describe 'FindView', ->
506506
expect(findView.descriptionLabel).toHaveClass 'text-error'
507507
expect(findView.descriptionLabel.text()).toContain 'Invalid regular expression'
508508

509+
it "does not reset when the buffer is updated", ->
510+
# This is a rather specific test: the error message only disappeared
511+
# when there were no changes. Backspacing nothing can reproduce this,
512+
# as well as saving or undoing and then redoing.
513+
editor.setCursorBufferPosition([0, 0])
514+
# Since we're at the beginning of the file, backspacing will do nothing but still send a change event
515+
editor.backspace()
516+
advanceClock(editor.buffer.stoppedChangingDelay)
517+
518+
expect(findView.descriptionLabel).toHaveClass 'text-error'
519+
expect(findView.descriptionLabel.text()).toContain 'Invalid regular expression'
520+
509521
it "will be reset when there is no longer an error", ->
510522
expect(findView.descriptionLabel).toHaveClass 'text-error'
511523

0 commit comments

Comments
 (0)