Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 1936493

Browse files
zagginoficristo
authored andcommitted
fixes 3 failing find-in-files tests (#12973)
* fixes 3 failing find-in-files tests * implement proposed change
1 parent f7d4e35 commit 1936493

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/search/SearchModel.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ define(function (require, exports, module) {
111111
* Clears out the model to an empty state.
112112
*/
113113
SearchModel.prototype.clear = function () {
114+
var numMatchesBefore = this.numMatches;
114115
this.results = {};
115116
this.queryInfo = null;
116117
this.queryExpr = null;
@@ -120,7 +121,9 @@ define(function (require, exports, module) {
120121
this.numMatches = 0;
121122
this.foundMaximum = false;
122123
this.exceedsMaximum = false;
123-
this.fireChanged();
124+
if (numMatchesBefore !== 0) {
125+
this.fireChanged();
126+
}
124127
};
125128

126129
/**

test/spec/FindInFiles-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,8 @@ define(function (require, exports, module) {
785785
gotChange = false;
786786
oldResults = null;
787787
wasQuickChange = false;
788+
789+
FindInFiles.clearSearch(); // calls FindInFiles.searchModel.clear internally
788790
FindInFiles.searchModel.on("change.FindInFilesTest", function (event, quickChange) {
789791
gotChange = true;
790792
wasQuickChange = quickChange;

0 commit comments

Comments
 (0)