Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 7250b96

Browse files
committed
Fix JSLint/JSHint errors (some of which were on master).
Small docs & formatting tweaks. Fix merge cruft in Editor-test & CSSUtils-test.
1 parent f59be5a commit 7250b96

6 files changed

Lines changed: 19 additions & 23 deletions

File tree

src/editor/EditorManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ define(function (require, exports, module) {
332332

333333
if (!editor) {
334334
if (!(document instanceof DocumentManager.Document)) {
335-
throw new Error("_destroyEditorIfUnneeded() takes a Document arg, not an Editor");
335+
throw new Error("_destroyEditorIfUnneeded() should be passed a Document");
336336
}
337337
return;
338338
}
@@ -676,7 +676,7 @@ define(function (require, exports, module) {
676676
// an inline widget's editor has focus, so close it
677677
PerfUtils.markStart(PerfUtils.INLINE_WIDGET_CLOSE);
678678
inlineWidget.close().done(function () {
679-
PerfUtils.addMeasurement(PerfUtils.INLINE_WIDGET_CLOSE);
679+
PerfUtils.addMeasurement(PerfUtils.INLINE_WIDGET_CLOSE);
680680
// return a resolved promise to CommandManager
681681
result.resolve(false);
682682
});

src/language/LanguageManager.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ define(function (require, exports, module) {
175175
/**
176176
* Resolves a language ID to a Language object.
177177
* File names have a higher priority than file extensions.
178-
* @param {!string} id Identifier for this language: lowercase letters and digits with _ separators (e.g. "cpp", "foo_bar", "c99")
178+
* @param {!string} id Identifier for this language: lowercase letters, digits, and _ separators (e.g. "cpp", "foo_bar", "c99")
179179
* @return {Language} The language with the provided identifier or undefined
180180
*/
181181
function getLanguage(id) {
@@ -322,7 +322,7 @@ define(function (require, exports, module) {
322322

323323
/**
324324
* Sets the identifier for this language or prints an error to the console.
325-
* @param {!string} id Identifier for this language: lowercase letters and digits with _ separators (e.g. "cpp", "foo_bar", "c99")
325+
* @param {!string} id Identifier for this language: lowercase letters, digits, and _ separators (e.g. "cpp", "foo_bar", "c99")
326326
* @return {boolean} Whether the ID was valid and set or not
327327
*/
328328
Language.prototype._setId = function (id) {
@@ -637,11 +637,11 @@ define(function (require, exports, module) {
637637
/**
638638
* Defines a language.
639639
*
640-
* @param {!string} id Unique identifier for this language: lowercase letters and digits with _ separators (e.g. "cpp", "foo_bar", "c99")
640+
* @param {!string} id Unique identifier for this language: lowercase letters, digits, and _ separators (e.g. "cpp", "foo_bar", "c99")
641641
* @param {!Object} definition An object describing the language
642642
* @param {!string} definition.name Human-readable name of the language, as it's commonly referred to (e.g. "C++")
643-
* @param {Array.<string>} definition.fileExtensions List of file extensions used by this language (e.g. ["php", "php3"]). May contain periods (e.g. ["coffee.md"])
644-
* @param {Array.<string>} definition.fileNames List of file names (e.g. ["Makefile"] or ["package.json])
643+
* @param {Array.<string>} definition.fileExtensions List of file extensions used by this language (e.g. ["php", "php3"] or ["coffee.md"] - may contain dots)
644+
* @param {Array.<string>} definition.fileNames List of exact file names (e.g. ["Makefile"] or ["package.json]). Higher precedence than file extension.
645645
* @param {Array.<string>} definition.blockComment Array with two entries defining the block comment prefix and suffix (e.g. ["<!--", "-->"])
646646
* @param {string|Array.<string>} definition.lineComment Line comment prefixes (e.g. "//" or ["//", "#"])
647647
* @param {string|Array.<string>} definition.mode CodeMirror mode (e.g. "htmlmixed"), optionally with a MIME mode defined by that mode ["clike", "text/x-c++src"]

test/spec/CSSUtils-test.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -973,10 +973,10 @@ define(function (require, exports, module) {
973973

974974
// Braces inside string; string inside rule (not inside selector)
975975
css = "a::after { content: ' {' attr(href) '}'; } \n" +
976-
".foo { color:red } \n" +
977-
"a::after { content: \" {\" attr(href) \"}\"; } \n" +
978-
"li::before { content: \"} h4 { color:black }\"; } \n" +
979-
"div { color:green }";
976+
".foo { color:red } \n" +
977+
"a::after { content: \" {\" attr(href) \"}\"; } \n" +
978+
"li::before { content: \"} h4 { color:black }\"; } \n" +
979+
"div { color:green }";
980980

981981
result = match(css, { tag: "a" });
982982
expect(result.length).toBe(2);
@@ -999,7 +999,7 @@ define(function (require, exports, module) {
999999
expect(result.length).toBe(1);
10001000

10011001
css = "@import \"null?\\\"{\"; \n" + // a real-world CSS hack similar to the above case
1002-
"div { color: red }";
1002+
"div { color: red }";
10031003
result = match(css, { tag: "div" });
10041004
expect(result.length).toBe(1);
10051005

@@ -1051,9 +1051,9 @@ define(function (require, exports, module) {
10511051
expect(result.length).toBe(1);
10521052

10531053
css = ".foo\n" +
1054-
"{\n" +
1055-
" color: red;\n" +
1056-
"}";
1054+
"{\n" +
1055+
" color: red;\n" +
1056+
"}";
10571057
result = match(css, { clazz: "foo" });
10581058
expect(result.length).toBe(1);
10591059
});
@@ -1425,11 +1425,9 @@ define(function (require, exports, module) {
14251425
});
14261426

14271427
afterEach(function () {
1428-
brackets = null;
14291428
CSSUtils = null;
14301429
DocumentManager = null;
14311430
FileViewController = null;
1432-
ProjectManager = null;
14331431
SpecRunnerUtils.closeTestWindow();
14341432
});
14351433

test/spec/Editor-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ define(function (require, exports, module) {
113113

114114
it("should set mode based on Document language", function () {
115115
createTestEditor(defaultContent, "html");
116-
var mode = LanguageManager.getLanguageForPath("only/testing/the/path.css").getMode();
117116

118117
var htmlLanguage = LanguageManager.getLanguage("html");
119118
expect(myEditor.getModeForDocument()).toBe(htmlLanguage.getMode());

test/spec/InstallExtensionDialog-test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ define(function (require, exports, module) {
522522
});
523523
});
524524

525+
// Cancelation vs. successful install race conditions
525526
it("should keep close button enabled and not throw an exception if install succeeds quickly after cancelation", function () {
526527
var deferred = new $.Deferred(),
527528
installer = makeInstaller(null, deferred);
@@ -534,7 +535,6 @@ define(function (require, exports, module) {
534535
expect(fields.$okButton.prop("disabled")).toBe(false);
535536
});
536537
});
537-
538538
it("should keep close button enabled and not throw an exception if install succeeds slowly after cancelation", function () {
539539
var deferred = new $.Deferred(),
540540
installer = makeInstaller(null, deferred);
@@ -567,6 +567,7 @@ define(function (require, exports, module) {
567567
});
568568
});
569569

570+
// Cancelation vs. failed install race conditions
570571
it("should keep close button enabled and not throw an exception if install fails quickly after cancelation", function () {
571572
var deferred = new $.Deferred(),
572573
installer = makeInstaller(null, deferred);
@@ -594,7 +595,6 @@ define(function (require, exports, module) {
594595
expect(fields.$okButton.prop("disabled")).toBe(false);
595596
});
596597
});
597-
598598
it("should stay closed and not throw an exception if install fails after cancelation & force close", function () {
599599
var deferred = new $.Deferred(),
600600
installer = makeInstaller(null, deferred);
@@ -612,6 +612,7 @@ define(function (require, exports, module) {
612612
});
613613
});
614614

615+
// Cancelation actually suceeding
615616
it("should keep close button enabled and not throw an exception if install cancelation completes quickly after cancelation", function () {
616617
var deferred = new $.Deferred(),
617618
installer = makeInstaller(null, deferred);
@@ -624,7 +625,6 @@ define(function (require, exports, module) {
624625
expect(fields.$okButton.prop("disabled")).toBe(false);
625626
});
626627
});
627-
628628
it("should keep close button enabled and not throw an exception if install cancelation completes slowly after cancelation", function () {
629629
var deferred = new $.Deferred(),
630630
installer = makeInstaller(null, deferred);
@@ -640,7 +640,6 @@ define(function (require, exports, module) {
640640
expect(fields.$okButton.prop("disabled")).toBe(false);
641641
});
642642
});
643-
644643
it("should stay closed and not throw an exception if install cancelation completes after cancelation & force close", function () {
645644
var deferred = new $.Deferred(),
646645
installer = makeInstaller(null, deferred);

test/spec/LanguageManager-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ define(function (require, exports, module) {
151151
expect(LanguageManager.getLanguageForPath("/only/testing/the/path.css")).toBe(css); // abs Mac/Linux-style
152152
expect(LanguageManager.getLanguageForPath("only/testing/the/path.css")).toBe(css); // relative
153153

154-
// Things that aren't extensions
154+
// Unknown file types
155155
expect(LanguageManager.getLanguageForPath("/code/html")).toBe(unknown);
156156
expect(LanguageManager.getLanguageForPath("/code/foo.html.notreally")).toBe(unknown);
157157
});

0 commit comments

Comments
 (0)