Skip to content

Commit 5393ee4

Browse files
committed
fixed some issues mentioned in the review
- added some forgotten waitsForDone() calls - added a missing test case for dynamic-project-6 - check document and if it doesn't have a masterEditor before adding the document to the workspace - removed the waits() call after invalidating the FileIndexManager - re-enabled the message dialog if no suitable document was found for Live Preview
1 parent 667094c commit 5393ee4

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

src/LiveDevelopment/LiveDevelopment.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,9 @@ define(function LiveDevelopment(require, exports, module) {
11651165
_getInitialDocFromCurrent().done(function (doc) {
11661166
var prepareServerPromise = (doc && _prepareServer(doc)) || new $.Deferred().reject();
11671167

1168-
DocumentManager.addToWorkingSet(doc.file);
1168+
if (doc && !doc._masterEditor) {
1169+
DocumentManager.addToWorkingSet(doc.file);
1170+
}
11691171

11701172
// wait for server (StaticServer, Base URL or file:)
11711173
prepareServerPromise

test/spec/LiveDevelopment-test.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,9 +1004,7 @@ define(function (require, exports, module) {
10041004

10051005
function loadFileAndUpdateFileIndex(fileToLoadIntoEditor) {
10061006
runs(function () {
1007-
// TODO: check if this is really necessary
10081007
FileIndexManager.markDirty();
1009-
waits(2000);
10101008
waitsForDone(SpecRunnerUtils.openProjectFiles([fileToLoadIntoEditor]), "SpecRunnerUtils.openProjectFiles " + fileToLoadIntoEditor);
10111009
});
10121010
}
@@ -1029,6 +1027,8 @@ define(function (require, exports, module) {
10291027
promise.done(function (doc) {
10301028
document = doc;
10311029
});
1030+
1031+
waitsForDone(promise);
10321032
});
10331033

10341034
runs(function () {
@@ -1199,6 +1199,8 @@ define(function (require, exports, module) {
11991199
promise.done(function (doc) {
12001200
document = doc;
12011201
});
1202+
1203+
waitsForDone(promise);
12021204
});
12031205

12041206
runs(function () {
@@ -1305,6 +1307,30 @@ define(function (require, exports, module) {
13051307
expect(document.file.fullPath).toBe(testPath + "/dynamic-project-5/" + indexFile);
13061308
});
13071309
});
1310+
1311+
it("should not find any HTML page", function () {
1312+
var promise,
1313+
document;
1314+
var cssFile = "top2/test.css";
1315+
1316+
SpecRunnerUtils.loadProjectInTestWindow(testPath + "/dynamic-project-6");
1317+
loadFileAndUpdateFileIndex(cssFile);
1318+
1319+
runs(function () {
1320+
ProjectManager.setBaseUrl("http://localhost:6666/");
1321+
promise = LiveDevelopment._getInitialDocFromCurrent();
1322+
1323+
promise.done(function (doc) {
1324+
document = doc;
1325+
});
1326+
1327+
waitsForDone(promise);
1328+
});
1329+
1330+
runs(function () {
1331+
expect(document).toBe(null);
1332+
});
1333+
});
13081334
});
13091335
});
13101336
});

0 commit comments

Comments
 (0)