Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions src/LiveDevelopment/Documents/HTMLDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,13 @@ define(function HTMLDocumentModule(require, exports, module) {
*/
HTMLDocument.prototype.getResponseData = function getResponseData(enabled) {
var body;
if (this._instrumentationEnabled && this.editor) {
body = HTMLInstrumentation.generateInstrumentedHTML(this.editor);
if (this._instrumentationEnabled) {
if (this.editor) {
body = HTMLInstrumentation.generateInstrumentedHTML(this.editor);
} else {
this.doc._ensureMasterEditor();
body = HTMLInstrumentation.generateInstrumentedHTML(this.doc._masterEditor);
}
}

return {
Expand Down
15 changes: 14 additions & 1 deletion test/spec/LiveDevelopment-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,9 @@ define(function (require, exports, module) {
it("should reload the page when editing a non-live document", function () {
var promise,
jsdoc,
loadEventPromise;
loadEventPromise,
liveDoc,
liveResponse;

runs(function () {
// Setup reload spy
Expand Down Expand Up @@ -1158,6 +1160,17 @@ define(function (require, exports, module) {
runs(function () {
expect(Inspector.Page.reload.callCount).toEqual(2);
});

waitForLiveDoc(tempDir + "/simple1.html", function (doc) {
liveDoc = doc;
liveResponse = doc.getResponseData();
});

runs(function () {
// Make sure a reload without an editor still sends back instrumented HTML
expect(liveDoc.editor).toBe(null);
expect(liveResponse.body.indexOf("data-brackets-id")).not.toBe(-1);
});
});

});
Expand Down