Skip to content

Commit d5e6f91

Browse files
committed
test: integ tests for go to next and previous problem
1 parent ff875b0 commit d5e6f91

1 file changed

Lines changed: 46 additions & 2 deletions

File tree

test/spec/CodeInspection-integ-test.js

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ define(function (require, exports, module) {
113113
if (!("sticky" in pos)) {
114114
pos.sticky = null;
115115
}
116+
return pos;
116117
}
117118

118119
let savedCopyFn;
@@ -1110,7 +1111,7 @@ define(function (require, exports, module) {
11101111
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["errors.js"]), "open test file");
11111112

11121113
CommandManager.execute(Commands.NAVIGATE_GOTO_FIRST_PROBLEM);
1113-
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEqual(fixPos({line: 1, ch: 3}));
1114+
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEql(fixPos({line: 1, ch: 3}));
11141115
});
11151116

11161117
it("should be able to copy problem message", async function () {
@@ -1159,7 +1160,50 @@ define(function (require, exports, module) {
11591160

11601161
CommandManager.execute(Commands.NAVIGATE_GOTO_FIRST_PROBLEM);
11611162
// 'first' error is in order of linter registration, not in line number order
1162-
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEqual(fixPos({line: 1, ch: 3}));
1163+
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEql(fixPos({line: 1, ch: 3}));
1164+
});
1165+
1166+
it("should Go to Next and previous Error with errors from two providers", async function () {
1167+
var codeInspector1 = createCodeInspector("javascript linter 1", {
1168+
errors: [
1169+
{
1170+
pos: { line: 1, ch: 3 },
1171+
message: "Some errors here and there",
1172+
type: CodeInspection.Type.WARNING
1173+
},
1174+
{
1175+
pos: { line: 1, ch: 9 },
1176+
message: "another error",
1177+
type: CodeInspection.Type.WARNING
1178+
}
1179+
]
1180+
});
1181+
var codeInspector2 = createCodeInspector("javascript linter 2", {
1182+
errors: [
1183+
{
1184+
pos: { line: 0, ch: 2 },
1185+
message: "Different error",
1186+
type: CodeInspection.Type.WARNING
1187+
}
1188+
]
1189+
});
1190+
CodeInspection.register("javascript", codeInspector1);
1191+
CodeInspection.register("javascript", codeInspector2);
1192+
1193+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["errors.js"]), "open test file");
1194+
1195+
const editor = EditorManager.getActiveEditor();
1196+
editor.setCursorPos(0, 0);
1197+
CommandManager.execute(Commands.NAVIGATE_GOTO_NEXT_PROBLEM);
1198+
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEql(fixPos({line: 1, ch: 0}));
1199+
CommandManager.execute(Commands.NAVIGATE_GOTO_NEXT_PROBLEM);
1200+
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEql(fixPos({line: 1, ch: 8}));
1201+
CommandManager.execute(Commands.NAVIGATE_GOTO_NEXT_PROBLEM);
1202+
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEql(fixPos({line: 1, ch: 8}));
1203+
CommandManager.execute(Commands.NAVIGATE_GOTO_PREV_PROBLEM);
1204+
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEql(fixPos({line: 1, ch: 0}));
1205+
CommandManager.execute(Commands.NAVIGATE_GOTO_PREV_PROBLEM);
1206+
expect(fixPos(EditorManager.getActiveEditor().getCursorPos())).toEql(fixPos({line: 0, ch: 0}));
11631207
});
11641208

11651209
it("should not show providers that returns isIgnored", async function () {

0 commit comments

Comments
 (0)