Unit tests: Fix autoscroll with skipped tests
This commit is contained in:
parent
35c13212dd
commit
29f29f6c6e
|
@ -19,7 +19,23 @@
|
||||||
<script src="lib/unittests-bundle.js"></script>
|
<script src="lib/unittests-bundle.js"></script>
|
||||||
<script>
|
<script>
|
||||||
if (typeof openpgp !== 'undefined') {
|
if (typeof openpgp !== 'undefined') {
|
||||||
mocha.run();
|
const runner = mocha.run();
|
||||||
|
var wasScrolledDown = true;
|
||||||
|
function beforeTestReport() {
|
||||||
|
wasScrolledDown = document.documentElement.scrollHeight - document.documentElement.scrollTop - document.documentElement.clientHeight < 50;
|
||||||
|
}
|
||||||
|
function afterTestReport() {
|
||||||
|
if (wasScrolledDown || openpgp.config.ci) {
|
||||||
|
window.scrollTo(0, document.documentElement.scrollHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runner._events['suite'].unshift(beforeTestReport);
|
||||||
|
runner._events['pass'].unshift(beforeTestReport);
|
||||||
|
runner._events['fail'].unshift(beforeTestReport);
|
||||||
|
runner._events['pending'].unshift(beforeTestReport);
|
||||||
|
document.addEventListener('scroll', beforeTestReport);
|
||||||
|
runner.on('suite', afterTestReport);
|
||||||
|
runner.on('test end', afterTestReport);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -36,13 +36,6 @@ describe('Unit Tests', function () {
|
||||||
openpgp.config.s2k_iteration_count_byte = 0;
|
openpgp.config.s2k_iteration_count_byte = 0;
|
||||||
openpgp.config.indutny_elliptic_path = '../dist/elliptic.min.js';
|
openpgp.config.indutny_elliptic_path = '../dist/elliptic.min.js';
|
||||||
|
|
||||||
afterEach(function () {
|
|
||||||
if (window.scrollY >= document.body.scrollHeight - window.innerHeight - 100
|
|
||||||
|| openpgp.config.ci) {
|
|
||||||
window.scrollTo(0, document.body.scrollHeight);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.location.search.substr(1).split('&').forEach(param => {
|
window.location.search.substr(1).split('&').forEach(param => {
|
||||||
const [key, value] = param.split('=');
|
const [key, value] = param.split('=');
|
||||||
if (key && key !== 'grep') {
|
if (key && key !== 'grep') {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user