Skip to content

Commit bd655fb

Browse files
committed
test: integ test for code inspection fixes infrastructure
1 parent ae51bff commit bd655fb

7 files changed

Lines changed: 572 additions & 10 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-node/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/language/CodeInspection.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,13 @@ define(function (require, exports, module) {
508508
_populateDummyGutterElements(editor, from, to);
509509
}
510510

511-
function _scrollToTableLine(lineNumber) {
511+
function scrollToProblem(lineNumber) {
512512
const $lineElement = $problemsPanelTable.find('td.line-number[data-line="' + lineNumber + '"]');
513513
if ($lineElement.length) {
514514
$lineElement[0].scrollIntoView({ behavior: 'instant', block: 'start' });
515+
return true;
515516
}
517+
return false;
516518
}
517519

518520

@@ -532,7 +534,7 @@ define(function (require, exports, module) {
532534
${mark.message}<br/>
533535
</div>`);
534536
$problemView.find(".fix-problem-btn").click(()=>{
535-
_scrollToTableLine(pos.line);
537+
scrollToProblem(pos.line);
536538
_fixProblem(fixID);
537539
});
538540
$hoverMessage.append($problemView);
@@ -543,7 +545,7 @@ define(function (require, exports, module) {
543545
// eslint-disable-next-line no-loop-func
544546
$problemView.click(function () {
545547
toggleCollapsed(false);
546-
_scrollToTableLine(pos.line);
548+
scrollToProblem(pos.line);
547549
});
548550
const markPos = mark.find();
549551
if(markPos.from && markPos.from.line < startPos.line){
@@ -754,12 +756,10 @@ define(function (require, exports, module) {
754756
// Update results table
755757
html = Mustache.render(ResultsTemplate, {Strings: Strings, reportList: allErrors});
756758

757-
const scrollPosition = scrollPositionMap.get(fullFilePath) || 0;
758759
$problemsPanelTable.lintFilePath = fullFilePath;
759760
$problemsPanelTable
760761
.empty()
761-
.append(html)
762-
.scrollTop(scrollPosition); // otherwise scroll pos from previous contents is remembered
762+
.append(html); // otherwise scroll pos from previous contents is remembered
763763

764764
if (!_collapsed) {
765765
problemsPanel.show();
@@ -769,6 +769,8 @@ define(function (require, exports, module) {
769769
path.basename(fullFilePath));
770770
setGotoEnabled(true);
771771

772+
const scrollPosition = scrollPositionMap.get(fullFilePath) || 0;
773+
$problemsPanelTable.scrollTop(scrollPosition);
772774
PerfUtils.addMeasurement(perfTimerDOM);
773775
});
774776

@@ -1180,4 +1182,5 @@ define(function (require, exports, module) {
11801182
exports.requestRun = run;
11811183
exports.getProvidersForPath = getProvidersForPath;
11821184
exports.getProviderIDsForLanguage = getProviderIDsForLanguage;
1185+
exports.scrollToProblem = scrollToProblem;
11831186
});

test/UnitTestSuite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ define(function (require, exports, module) {
8181
require("spec/ViewUtils-test");
8282
require("spec/XMLUtils-test");
8383
require("spec/CodeInspection-integ-test");
84+
require("spec/CodeInspection-fix-integ-test");
8485
require("spec/CodeHint-integ-test");
8586
require("spec/CSSInlineEdit-integ-test");
8687
require("spec/DocumentCommandHandlers-integ-test");

0 commit comments

Comments
 (0)