Skip to content

Commit 1c7f6e6

Browse files
committed
test: code inspection integ tests fix one error button
1 parent 3848edc commit 1c7f6e6

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test/spec/CodeInspection-fix-integ-test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,28 @@ define(function (require, exports, module) {
265265
expect($("#problems-panel .ph-fix-problem").length).toBe(5); // 5 fix buttons should be there
266266
});
267267

268+
it("should fix one error by clicking fix button and undo", async function () {
269+
await _openProjectFile("testFix.vbs");
270+
const editor = EditorManager.getActiveEditor();
271+
editor.setCursorPos(1, 1);
272+
273+
expect($("#problems-panel").is(":visible")).toBeTrue();
274+
expect($("#problems-panel .ph-fix-problem").length).toBe(5); // 5 fix buttons should be there
275+
276+
// fix first error
277+
$($("#problems-panel").find(".ph-fix-problem")[0]).click();
278+
expect($("#problems-panel .ph-fix-problem").length).toBe(4);
279+
280+
// fixing multiple should place the cursor on first fix
281+
expect(editor.getSelectedText()).toBe("no");
282+
283+
// undo should work
284+
await awaitsForDone(CommandManager.execute(Commands.EDIT_UNDO), "undo");
285+
expect(editor.getSelectedText()).toBe("fixable");
286+
await _triggerLint("testFix.vbs");
287+
expect($("#problems-panel .ph-fix-problem").length).toBe(5); // 5 fix buttons should be there
288+
});
289+
268290
// todo invalid fixes test, doc changed after fix dialog
269291

270292
});

0 commit comments

Comments
 (0)