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

Fix FindInFiles tests #12951

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions test/spec/FindInFiles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,9 @@ define(function (require, exports, module) {
oldResults = null;
wasQuickChange = false;
FindInFiles.searchModel.on("change.FindInFilesTest", function (event, quickChange) {
if (!FindInFiles.searchModel.hasResults()) {
return;
}
gotChange = true;
wasQuickChange = quickChange;
});
Expand Down Expand Up @@ -2218,13 +2221,24 @@ define(function (require, exports, module) {

describe("Panel closure on changes", function () {
it("should close the panel and detach listeners if a file is modified on disk", function () {
var gotChange = false,
wasQuickChange;
FindInFiles.searchModel.on("change.FindInFilesTest", function (event, quickChange) {
if (!FindInFiles.searchModel.hasResults()) {
return;
}
gotChange = true;
wasQuickChange = quickChange;
});
showSearchResults("foo", "bar");
runs(function () {
expect($("#find-in-files-results").is(":visible")).toBe(true);
waitsForDone(promisify(FileSystem.getFileForPath(testPath + "/foo.html"), "write", "changed content"));
});
waitsFor(function () { return gotChange; }, "model change event");
runs(function () {
expect($("#find-in-files-results").is(":visible")).toBe(false);
FindInFiles.searchModel.off(".FindInFilesTest");
});
});

Expand Down