Merge branch 'master' into load-subdirs

This commit is contained in:
dloverin committed 2013-05-10 12:43:28 -04:00
commit dc9aba5fca
50 files changed
+1124 -220

No files matched your search

@@ -37,6 +37,7 @@ define(function (require, exports, module) {
var extensionPath = FileUtils.getNativeModuleDirectoryPath(module),
testPath = extensionPath + "/unittest-files/basic-test-files/file1.js",
testHtmlPath = extensionPath + "/test/index.html",
testDoc = null,
testEditor;
@@ -791,8 +792,69 @@ define(function (require, exports, module) {
});
});
});
describe("JavaScript Code Hinting in a HTML file", function () {
beforeEach(function () {
DocumentManager.getDocumentForPath(testHtmlPath).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);
});
});
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;
});
describe("JavaScript Code Hinting without modules", function () {
it("basic codehints in html file", function () {
var start = { line: 30, ch: 9 },
end = { line: 30, ch: 11 };
testDoc.replaceRange("x.", start, start);
testEditor.setCursorPos(end);
var hintObj = expectHints(JSCodeHints.jsHintProvider);
runs(function () {
hintsPresentOrdered(hintObj, ["charAt", "charCodeAt", "concat", "indexOf"]);
});
});
it("function type hint in html file", function () {
var start = { line: 29, ch: 12 };
testEditor.setCursorPos(start);
var hintObj = expectHints(JSCodeHints.jsHintProvider);
runs(function () {
hintsPresentExact(hintObj, ["foo(a: number) -> string"]);
});
});
it("jump-to-def in html file", function () {
var start = { line: 29, ch: 10 };
testEditor.setCursorPos(start);
runs(function () {
editorJumped({line: 18, ch: 20});
});
});
});
describe("JavaScript Code Hinting without modules", function () {
var testPath = extensionPath + "/unittest-files/non-module-test-files/app.js";
beforeEach(function () {
@@ -816,5 +878,6 @@ define(function (require, exports, module) {
});
});
});
});
});
});