Skip to content

Commit

Permalink
chore: reverse highlight disable integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Jan 11, 2024
1 parent 61d1694 commit a201987
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion test/spec/LiveDevelopmentMultiBrowser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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')){
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit a201987

Please sign in to comment.