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

Commit e81f8df

Browse files
committed
Add tests to prevent superfluous update events
1 parent 5fa4b3b commit e81f8df

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/buffer-search-spec.coffee

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,25 @@ describe "BufferSearch", ->
376376

377377
expect(scannedRanges()).toEqual []
378378

379+
describe "when no markers are affected in a change event", ->
380+
it "does not emit an update event", ->
381+
editor.setCursorBufferPosition([0, 0])
382+
editor.backspace()
383+
advanceClock(editor.buffer.stoppedChangingDelay)
384+
expectNoUpdateEvent()
385+
386+
describe "when the find pattern is invalid and a change occurs", ->
387+
it "does not attempt to update markers", ->
388+
model.search "a(",
389+
caseSensitive: false
390+
useRegex: true
391+
wholeWord: false
392+
393+
editor.insertText(".")
394+
advanceClock(editor.buffer.stoppedChangingDelay)
395+
396+
expectNoUpdateEvent()
397+
379398
describe "replacing a search result", ->
380399
beforeEach ->
381400
editor.scanInBufferRange.reset()

0 commit comments

Comments
 (0)