From a201987ca4e4e508de35c6568da76b188a1807bd Mon Sep 17 00:00:00 2001 From: abose Date: Thu, 11 Jan 2024 20:00:18 +0530 Subject: [PATCH] chore: reverse highlight disable integration tests --- test/spec/LiveDevelopmentMultiBrowser-test.js | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/spec/LiveDevelopmentMultiBrowser-test.js b/test/spec/LiveDevelopmentMultiBrowser-test.js index 305e854a8..a9df267a0 100644 --- a/test/spec/LiveDevelopmentMultiBrowser-test.js +++ b/test/spec/LiveDevelopmentMultiBrowser-test.js @@ -54,7 +54,8 @@ define(function (require, exports, module) { CommandManager, BeautificationManager, Commands, - WorkspaceManager; + WorkspaceManager, + PreferencesManager; let testFolder = SpecRunnerUtils.getTestPath("/spec/LiveDevelopment-MultiBrowser-test-files"), prettierTestFolder = SpecRunnerUtils.getTestPath("/spec/prettier-test-files"), @@ -93,6 +94,7 @@ define(function (require, exports, module) { EditorManager = brackets.test.EditorManager; WorkspaceManager = brackets.test.WorkspaceManager; BeautificationManager = brackets.test.BeautificationManager; + PreferencesManager = brackets.test.PreferencesManager; await SpecRunnerUtils.loadProjectInTestWindow(testFolder); if(!WorkspaceManager.isPanelVisible('live-preview-panel')){ @@ -112,7 +114,11 @@ define(function (require, exports, module) { EditorManager = null; }, 30000); + async function _enableLiveHighlights(enable) { + PreferencesManager.setViewState("livedev.highlight", enable); + } async function endPreviewSession() { + await _enableLiveHighlights(true); LiveDevMultiBrowser.close(); await awaitsForDone(CommandManager.execute(Commands.FILE_CLOSE_ALL, { _forceClose: true }), "closing all file"); @@ -756,6 +762,28 @@ define(function (require, exports, module) { await endPreviewSession(); }, 30000); + it("should reverse highlight be disabled if live highlight is disabled", async function () { + await _enableLiveHighlights(false); + await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), + "SpecRunnerUtils.openProjectFiles simple1.html"); + + await waitsForLiveDevelopmentToOpen(); + let editor = EditorManager.getActiveEditor(); + editor && editor.setCursorPos({ line: 0, ch: 0 }); + + await awaits(500); + await forRemoteExec(`document.getElementsByClassName("__brackets-ld-highlight").length`, (result)=>{ + return result === 0; + }); + await forRemoteExec(`document.getElementById("testId2").click()`); + + await awaits(500); + expect(editor.getCursorPos()).toEql({ line: 0, ch: 0, sticky: null }); + + await _enableLiveHighlights(true); + await endPreviewSession(); + }, 30000); + it("should ctrl-s to save page be disabled inside live preview iframes", async function () { await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html");