mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
load additional files if the loaded files are not using modules.
refactored unittest files.
This commit is contained in:
1 parent
3ec230c473
commit
f2ba60c17f
19 files changed
+645
-135
No files matched your search
@@ -36,7 +36,7 @@ define(function (require, exports, module) {
|
||||
JSCodeHints = require("main");
|
||||
|
||||
var extensionPath = FileUtils.getNativeModuleDirectoryPath(module),
|
||||
testPath = extensionPath + "/test/file1.js",
|
||||
testPath = extensionPath + "/unittest-files/basic-test-files/file1.js",
|
||||
testDoc = null,
|
||||
testEditor;
|
||||
|
||||
@@ -56,7 +56,7 @@ define(function (require, exports, module) {
|
||||
|
||||
// create Editor instance
|
||||
var editor = new Editor(doc, true, $editorHolder.get(0));
|
||||
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ define(function (require, exports, module) {
|
||||
if (key === undefined) {
|
||||
key = null;
|
||||
}
|
||||
|
||||
|
||||
expect(provider.hasHints(testEditor, key)).toBe(true);
|
||||
return provider.getHints(null);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ define(function (require, exports, module) {
|
||||
if (key === undefined) {
|
||||
key = null;
|
||||
}
|
||||
|
||||
|
||||
expect(provider.hasHints(testEditor, key)).toBe(false);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ define(function (require, exports, module) {
|
||||
hintList = obj.hints;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
waitsFor(function () {
|
||||
return complete;
|
||||
}, "Expected hints did not resolve", 3000);
|
||||
@@ -316,34 +316,41 @@ define(function (require, exports, module) {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
describe("JavaScript Code Hinting", function () {
|
||||
|
||||
|
||||
function setupTest(path, primePump) {
|
||||
DocumentManager.getDocumentForPath(path).done(function (doc) {
|
||||
testDoc = doc;
|
||||
});
|
||||
|
||||
waitsFor(function () {
|
||||
return testDoc !== null;
|
||||
}, "Unable to open test document", 10000);
|
||||
|
||||
// create Editor instance (containing a CodeMirror instance)
|
||||
runs(function () {
|
||||
testEditor = createMockEditor(testDoc);
|
||||
JSCodeHints.initializeSession(testEditor, primePump);
|
||||
});
|
||||
}
|
||||
|
||||
function tearDownTest() {
|
||||
// The following call ensures that the document is reloaded
|
||||
// from disk before each test
|
||||
DocumentManager.closeAll();
|
||||
|
||||
SpecRunnerUtils.destroyMockEditor(testDoc);
|
||||
testEditor = null;
|
||||
testDoc = null;
|
||||
}
|
||||
|
||||
describe("JavaScript Code Hinting Basic", function () {
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
DocumentManager.getDocumentForPath(testPath).done(function (doc) {
|
||||
testDoc = doc;
|
||||
});
|
||||
|
||||
waitsFor(function () {
|
||||
return testDoc !== null;
|
||||
}, "Unable to open test document", 10000);
|
||||
|
||||
// create Editor instance (containing a CodeMirror instance)
|
||||
runs(function () {
|
||||
testEditor = createMockEditor(testDoc);
|
||||
JSCodeHints.initializeSession(testEditor, false);
|
||||
});
|
||||
setupTest(testPath, false);
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
// The following call ensures that the document is reloaded
|
||||
// from disk before each test
|
||||
DocumentManager.closeAll();
|
||||
|
||||
SpecRunnerUtils.destroyMockEditor(testDoc);
|
||||
testEditor = null;
|
||||
testDoc = null;
|
||||
tearDownTest();
|
||||
});
|
||||
|
||||
it("should list declared variable and function names in outer scope", function () {
|
||||
@@ -599,7 +606,12 @@ define(function (require, exports, module) {
|
||||
var start = { line: 6, ch: 0 },
|
||||
middle = { line: 6, ch: 3 },
|
||||
end = { line: 6, ch: 8 };
|
||||
|
||||
// console.log("before waits: " + new Date().getMilliseconds());
|
||||
// waits(1000);
|
||||
//
|
||||
// runs(function () {
|
||||
// console.log("in runs waits: " + new Date().getMilliseconds());
|
||||
// });
|
||||
testDoc.replaceRange("A1.", start, start);
|
||||
testEditor.setCursorPos(middle);
|
||||
var hintObj = expectHints(JSCodeHints.jsHintProvider);
|
||||
@@ -780,5 +792,29 @@ define(function (require, exports, module) {
|
||||
});
|
||||
});
|
||||
|
||||
describe("JavaScript Code Hinting without modules", function () {
|
||||
var testPath = extensionPath + "/unittest-files/non-module-test-files/app.js";
|
||||
|
||||
beforeEach(function () {
|
||||
setupTest(testPath, true);
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
tearDownTest();
|
||||
});
|
||||
|
||||
// Test reading multiple files and subdirectories
|
||||
it("should handle reading all files when modules not used", function () {
|
||||
var start = { line: 8, ch: 8 };
|
||||
|
||||
runs(function () {
|
||||
testEditor.setCursorPos(start);
|
||||
var hintObj = expectHints(JSCodeHints.jsHintProvider);
|
||||
runs(function () {
|
||||
hintsPresentExact(hintObj, ["a", "b", "b1", "c", "d"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user