mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Add some more unit tests
covers require support, jsdoc, function types
This commit is contained in:
1 parent
daa64a3f3a
commit
ebc6b647c6
3 files changed
+65
-1
No files matched your search
@@ -0,0 +1,10 @@
|
||||
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
|
||||
/*global define, $ */
|
||||
define(function (require, exports, module) {
|
||||
"use strict";
|
||||
exports.a = function (a, b) {};
|
||||
exports.b = function () {
|
||||
return "a string";
|
||||
};
|
||||
exports.j = "hi";
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
|
||||
/*global brackets, $ */
|
||||
/*global brackets, require */
|
||||
|
||||
var A1 = { propA : 1 },
|
||||
A2 = { propA : 2 },
|
||||
@@ -20,4 +20,22 @@ function funB(paramB1, paramB2) {
|
||||
B1.foo = 0;
|
||||
console.log("hello\\\" world!");
|
||||
}
|
||||
|
||||
var s = "a string";
|
||||
var r = s;
|
||||
var t = r;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} a
|
||||
* @param {number} b
|
||||
*/
|
||||
function funD(a, b) {
|
||||
"use strict";
|
||||
return {x: a, y: b};
|
||||
}
|
||||
|
||||
require(["MyModule"], function (myModule) {
|
||||
'use strict';
|
||||
});
|
||||
@@ -574,6 +574,42 @@ define(function (require, exports, module) {
|
||||
});
|
||||
});
|
||||
|
||||
it("should list hints for string, as string assigned to 's', 's' assigned to 'r' and 'r' assigned to 't'", function () {
|
||||
var start = { line: 26, ch: 0 },
|
||||
middle = { line: 26, ch: 2 };
|
||||
|
||||
testDoc.replaceRange("t.", start, start);
|
||||
testEditor.setCursorPos(middle);
|
||||
var hintObj = expectHints(JSCodeHints.jsHintProvider);
|
||||
runs(function () {
|
||||
hintsPresentOrdered(hintObj, ["charAt", "charCodeAt", "concat", "indexOf"]);
|
||||
});
|
||||
});
|
||||
|
||||
it("should list function type", function () {
|
||||
var start = { line: 36, ch: 0 },
|
||||
middle = { line: 36, ch: 5 };
|
||||
|
||||
testDoc.replaceRange("funD(", start, start);
|
||||
testEditor.setCursorPos(middle);
|
||||
var hintObj = expectHints(JSCodeHints.jsHintProvider);
|
||||
runs(function () {
|
||||
hintsPresentExact(hintObj, ["funD(a: string, b: number) -> {x, y}"]);
|
||||
});
|
||||
});
|
||||
|
||||
it("should list exports from a requirejs module", function () {
|
||||
var start = { line: 39, ch: 0 },
|
||||
middle = { line: 39, ch: 9 };
|
||||
|
||||
testDoc.replaceRange("myModule.", start, start);
|
||||
testEditor.setCursorPos(middle);
|
||||
var hintObj = expectHints(JSCodeHints.jsHintProvider);
|
||||
runs(function () {
|
||||
hintsPresentExact(hintObj, ["a", "b"]);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user