Skip to content

Commit 3848edc

Browse files
committed
test: code inspection integ tests fix all button
1 parent 2461ac6 commit 3848edc

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ define(function (require, exports, module) {
220220
await _openProjectFile(fileName);
221221
}
222222

223-
it("should fix by clicking fix button in quick view", async function () {
223+
it("should fix by clicking fix button in quick view and undo", async function () {
224224
await _openProjectFile("testFix.vbs");
225225

226226
expect($("#problems-panel").is(":visible")).toBeTrue();
@@ -241,7 +241,30 @@ define(function (require, exports, module) {
241241
expect($("#problems-panel .ph-fix-problem").length).toBe(5); // 5 fix buttons should be there
242242
});
243243

244-
// todo fix all, fix all undo,
244+
it("should fix all by clicking fix all button and undo", async function () {
245+
await _openProjectFile("testFix.vbs");
246+
const editor = EditorManager.getActiveEditor();
247+
editor.setCursorPos(1, 1);
248+
249+
expect($("#problems-panel").is(":visible")).toBeTrue();
250+
expect($("#problems-panel .ph-fix-problem").length).toBe(5); // 5 fix buttons should be there
251+
252+
// fix all
253+
$($("#problems-panel").find(".problems-fix-all-btn")).click();
254+
expect($("#problems-panel .ph-fix-problem").length).toBe(0); // 0 fix button as all fixed
255+
256+
// fixing multiple should place the cursor on first fix
257+
expect(editor.hasSelection()).toBeFalse();
258+
expect(editor.getCursorPos()).toEql({line: 10, ch: 12, sticky: null});
259+
260+
await awaitsForDone(CommandManager.execute(Commands.EDIT_UNDO), "undo");
261+
expect(editor.hasSelection()).toBeFalse();
262+
expect(editor.getSelections().length).toBe(1); // no multi cursor on undo
263+
264+
await _triggerLint("testFix.vbs");
265+
expect($("#problems-panel .ph-fix-problem").length).toBe(5); // 5 fix buttons should be there
266+
});
267+
245268
// todo invalid fixes test, doc changed after fix dialog
246269

247270
});

0 commit comments

Comments
 (0)