-
Notifications
You must be signed in to change notification settings - Fork 7.6k
- modified the problems panel to support multiple code inspector #5235
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,8 +36,9 @@ define(function (require, exports, module) { | |
$, | ||
brackets, | ||
CodeInspection, | ||
EditorManager; | ||
|
||
EditorManager, | ||
previousState; | ||
|
||
var toggleJSLintResults = function (visible) { | ||
$("#status-inspection").triggerHandler("click"); | ||
expect($("#problems-panel").is(":visible")).toBe(visible); | ||
|
@@ -50,9 +51,12 @@ define(function (require, exports, module) { | |
// Load module instances from brackets.test | ||
$ = testWindow.$; | ||
brackets = testWindow.brackets; | ||
EditorManager = testWindow.brackets.test.EditorManager; | ||
CodeInspection = testWindow.brackets.test.CodeInspection; | ||
EditorManager = brackets.test.EditorManager; | ||
CodeInspection = brackets.test.CodeInspection; | ||
CodeInspection.toggleEnabled(true); | ||
// enable JSLint and preserve the previous state before we enable it for testing | ||
previousState = CodeInspection._getProviderState({name: "JSLint"}); | ||
CodeInspection._setProviderState({name: "JSLint"}, true); | ||
}); | ||
}); | ||
|
||
|
@@ -67,17 +71,16 @@ define(function (require, exports, module) { | |
brackets = null; | ||
EditorManager = null; | ||
SpecRunnerUtils.closeTestWindow(); | ||
|
||
// revert to previous state | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems valuable to still make sure the correct provider was invoked, too. I guess a true "unit" test would use one or more mock providers instead of the full-blown JSLint provider, though... |
||
CodeInspection._setProviderState({name: 'JSLint'}, previousState); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't be needed if using |
||
}); | ||
|
||
it("should run JSLint linter when a JavaScript document opens", function () { | ||
runs(function () { | ||
spyOn(testWindow, "JSLINT").andCallThrough(); | ||
}); | ||
|
||
waitsForDone(SpecRunnerUtils.openProjectFiles(["errors.js"]), "open test file"); | ||
|
||
runs(function () { | ||
expect(testWindow.JSLINT).toHaveBeenCalled(); | ||
expect($("#problems-panel").is(":visible")).toBe(true); | ||
}); | ||
}); | ||
|
||
|
@@ -98,6 +101,5 @@ define(function (require, exports, module) { | |
toggleJSLintResults(false); | ||
}); | ||
}); | ||
|
||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
<table class="bottom-panel-table table table-striped table-condensed row-highlight"> | ||
<tbody> | ||
{{#reportList}} | ||
<tr class="inspector-section" data-provider="{{providerName}}"> | ||
<td colspan="3"><span class="disclosure-triangle expanded"></span>{{providerName}} ({{numProblems}})</td> | ||
</tr> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it's better to interleave the results so they're just sorted together by line number? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (and then add a new column to show the linter name -- maybe hidden if there's only one linter enabled for a given filetype) |
||
{{#results}} | ||
<tr> | ||
<td class="line-number" data-character="{{pos.ch}}">{{friendlyLine}}</td> | ||
<td>{{message}}</td> | ||
<td>{{codeSnippet}}</td> | ||
<td class="line-text">{{message}}</td> | ||
<td class="line-snippet">{{codeSnippet}}</td> | ||
</tr> | ||
{{/results}} | ||
{{/reportList}} | ||
</tbody> | ||
</table> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
testWindow.
prefix is still needed -- otherwise you're running the test in the spec-runner window instead.