mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Merge pull request #3598 from eztierney/iss-3511
[JS Code Hints] Fix Issue #3511
This commit is contained in:
commit
d8b960d12f
4 files changed
+114
-13
No files matched your search
@@ -731,6 +731,53 @@ define(function (require, exports, module) {
|
||||
});
|
||||
});
|
||||
|
||||
it("should insert hint as [\"my-key\"] since 'my-key' is not a valid property name", function () {
|
||||
var start = { line: 49, ch: 0 },
|
||||
middle = { line: 49, ch: 5 },
|
||||
end = { line: 49, ch: 13 };
|
||||
|
||||
testDoc.replaceRange("arr.m", start, start);
|
||||
testEditor.setCursorPos(middle);
|
||||
var hintObj = expectHints(JSCodeHints.jsHintProvider);
|
||||
selectHint(JSCodeHints.jsHintProvider, hintObj, "my-key");
|
||||
runs(function () {
|
||||
expect(testEditor.getCursorPos()).toEqual(end);
|
||||
expect(testDoc.getRange(start, end)).toEqual("arr[\"my-key\"]");
|
||||
expect(testDoc.getLine(end.line).length).toEqual(13);
|
||||
});
|
||||
});
|
||||
|
||||
it("should insert hint as [\"my-key\"] make sure this works if nothing is typed after the '.'", function () {
|
||||
var start = { line: 49, ch: 0 },
|
||||
middle = { line: 49, ch: 4 },
|
||||
end = { line: 49, ch: 13 };
|
||||
|
||||
testDoc.replaceRange("arr.", start, start);
|
||||
testEditor.setCursorPos(middle);
|
||||
var hintObj = expectHints(JSCodeHints.jsHintProvider);
|
||||
selectHint(JSCodeHints.jsHintProvider, hintObj, "my-key");
|
||||
runs(function () {
|
||||
expect(testEditor.getCursorPos()).toEqual(end);
|
||||
expect(testDoc.getRange(start, end)).toEqual("arr[\"my-key\"]");
|
||||
expect(testDoc.getLine(end.line).length).toEqual(13);
|
||||
});
|
||||
});
|
||||
|
||||
it("should insert hint as '.for' since keywords can be used as property names", function () {
|
||||
var start = { line: 49, ch: 0 },
|
||||
middle = { line: 49, ch: 5 },
|
||||
end = { line: 49, ch: 7 };
|
||||
|
||||
testDoc.replaceRange("arr.f", start, start);
|
||||
testEditor.setCursorPos(middle);
|
||||
var hintObj = expectHints(JSCodeHints.jsHintProvider);
|
||||
selectHint(JSCodeHints.jsHintProvider, hintObj, "for");
|
||||
runs(function () {
|
||||
expect(testEditor.getCursorPos()).toEqual(end);
|
||||
expect(testDoc.getRange(start, end)).toEqual("arr.for");
|
||||
expect(testDoc.getLine(end.line).length).toEqual(7);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user