Prevent scrolling on initial challenge run
- Add additional parameter to function displayTestResults Correction to errors: Line exceeds the maximum line length of 80 max-len Do not scroll on JS challenges
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
window.common = (function({ $, common = { init: [] }}) {
|
window.common = (function({ $, common = { init: [] }}) {
|
||||||
|
|
||||||
common.displayTestResults = function displayTestResults(data = []) {
|
common.displayTestResults = function displayTestResults(data = [], down) {
|
||||||
$('#testSuite').children().remove();
|
$('#testSuite').children().remove();
|
||||||
$('#testSuite').fadeIn('slow');
|
$('#testSuite').fadeIn('slow');
|
||||||
data.forEach(({ err = false, text = '' }) => {
|
data.forEach(({ err = false, text = '' }) => {
|
||||||
@ -21,7 +21,11 @@ window.common = (function({ $, common = { init: [] }}) {
|
|||||||
`)
|
`)
|
||||||
.appendTo($('#testSuite'));
|
.appendTo($('#testSuite'));
|
||||||
});
|
});
|
||||||
$('#scroll-locker').animate({ scrollTop: $(document).height() }, 'slow');
|
if (down) {
|
||||||
|
$('#scroll-locker').animate(
|
||||||
|
{ scrollTop: $(document).height() }, 'slow'
|
||||||
|
);
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ $(document).ready(function() {
|
|||||||
return common.updateOutputDisplay('' + err);
|
return common.updateOutputDisplay('' + err);
|
||||||
}
|
}
|
||||||
common.updateOutputDisplay(output);
|
common.updateOutputDisplay(output);
|
||||||
common.displayTestResults(tests);
|
common.displayTestResults(tests, true);
|
||||||
if (solved) {
|
if (solved) {
|
||||||
common.showCompletion();
|
common.showCompletion();
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
return common.updateOutputDisplay('' + err);
|
return common.updateOutputDisplay('' + err);
|
||||||
}
|
}
|
||||||
common.displayTestResults(tests);
|
common.displayTestResults(tests, false);
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
({ err }) => {
|
({ err }) => {
|
||||||
@ -164,7 +164,7 @@ $(document).ready(function() {
|
|||||||
return common.updateOutputDisplay('' + err);
|
return common.updateOutputDisplay('' + err);
|
||||||
}
|
}
|
||||||
common.codeStorage.updateStorage(challengeName, originalCode);
|
common.codeStorage.updateStorage(challengeName, originalCode);
|
||||||
common.displayTestResults(tests);
|
common.displayTestResults(tests, false);
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
|
Reference in New Issue
Block a user