Skip to content

Commit 4f2427b

Browse files
committed
fix: live preview integ test failures
1 parent 8323ff5 commit 4f2427b

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

src/LiveDevelopment/MultiBrowserImpl/documents/LiveDocument.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ define(function (require, exports, module) {
8282

8383
this._clearErrorDisplay();
8484
this._detachFromEditor();
85-
86-
$(window).off(`focus.LiveDocument-${this.doc.file.fullPath}`);
8785
};
8886

8987
/**

test/spec/LiveDevelopmentMultiBrowser-test.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -925,20 +925,18 @@ define(function (require, exports, module) {
925925

926926
it("focus test: should html live previews never take focus from editor", async function () {
927927
// this test may fail if the test window doesn't have focus
928-
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
928+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["inline-style.html"]),
929929
"SpecRunnerUtils.openProjectFiles simple1.html");
930930

931931
await waitsForLiveDevelopmentToOpen();
932-
await _editFileAndVerifyLivePreview("simple1.html", { line: 11, ch: 45 }, 'hello world ',
933-
"testId", "Brackets is hello world awesome!");
934932

935933
let iFrame = testWindow.document.getElementById("panel-live-preview-frame");
936-
expect(iFrame.src.endsWith("simple1.html")).toBeTrue();
934+
expect(iFrame.src.endsWith("inline-style.html")).toBeTrue();
937935
iFrame.focus(); // live preview has focus but it can take html focus, the live preview has to
938936
// delegate focus to editor explicitly in case of html files.
939937
expect(testWindow.document.activeElement).toEqual(iFrame);
940938
// for html, it can take focus, but clicking on any non- text elemnt will make it loose focus to editor
941-
await forRemoteExec(`document.getElementById("testId2").click()`);
939+
await forRemoteExec(`document.getElementById("testId").click()`);
942940
await awaits(500);
943941
const activeElement = testWindow.document.activeElement;
944942
const editorHolder = testWindow.document.getElementById("editor-holder");
@@ -1006,8 +1004,6 @@ define(function (require, exports, module) {
10061004
"SpecRunnerUtils.openProjectFiles simple1.html");
10071005

10081006
await waitsForLiveDevelopmentToOpen();
1009-
await _editFileAndVerifyLivePreview("simple1.html", { line: 11, ch: 45 }, 'hello world ',
1010-
"testId", "Brackets is hello world awesome!");
10111007

10121008
let iFrame = testWindow.document.getElementById("panel-live-preview-frame");
10131009
expect(iFrame.src.endsWith("simple1.html")).toBeTrue();
@@ -1042,8 +1038,6 @@ define(function (require, exports, module) {
10421038
"SpecRunnerUtils.openProjectFiles simple1.html");
10431039

10441040
await waitsForLiveDevelopmentToOpen();
1045-
await _editFileAndVerifyLivePreview("simple1.html", { line: 11, ch: 45 }, 'hello world ',
1046-
"testId", "Brackets is hello world awesome!");
10471041

10481042
let iFrame = testWindow.document.getElementById("panel-live-preview-frame");
10491043
expect(iFrame.src.endsWith("simple1.html")).toBeTrue();
@@ -1604,24 +1598,24 @@ define(function (require, exports, module) {
16041598
}, 30000);
16051599

16061600
it("should beautify and undo not corrupt live preview", async function () {
1607-
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
1608-
"SpecRunnerUtils.openProjectFiles simple1.html");
1601+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple2.html"]),
1602+
"SpecRunnerUtils.openProjectFiles simple2.html");
16091603

16101604
await waitsForLiveDevelopmentToOpen();
1611-
await _editFileAndVerifyLivePreview("simple1.html", { line: 11, ch: 45 }, 'hello world ',
1612-
"testId", "Brackets is hello world awesome!");
1605+
await _editFileAndVerifyLivePreview("simple2.html", { line: 11, ch: 45 }, 'hello world ',
1606+
"simpId", "Brackets is hello world awesome!");
16131607

16141608
let editor = EditorManager.getActiveEditor();
16151609
await BeautificationManager.beautifyEditor(editor);
1616-
await _editFileAndVerifyLivePreview("simple1.html", { line: 11, ch: 73 }, 'yo',
1617-
"testId", "Brackets is hello world awesome!yo");
1610+
await _editFileAndVerifyLivePreview("simple2.html", { line: 11, ch: 73 }, 'yo',
1611+
"simpId", "Brackets is hello world awesome!yo");
16181612

16191613
await awaitsForDone(CommandManager.execute(Commands.EDIT_UNDO), "undo");
16201614
await awaitsForDone(CommandManager.execute(Commands.EDIT_UNDO), "undo");
16211615
await awaitsForDone(CommandManager.execute(Commands.EDIT_UNDO), "undo");
16221616

1623-
await _editFileAndVerifyLivePreview("simple1.html", { line: 11, ch: 45 }, 'hello world ',
1624-
"testId", "Brackets is hello world awesome!");
1617+
await _editFileAndVerifyLivePreview("simple2.html", { line: 11, ch: 45 }, 'hello world ',
1618+
"simpId", "Brackets is hello world awesome!");
16251619

16261620
await endPreviewSession();
16271621
}, 30000);

0 commit comments

Comments
 (0)