From 7c3bbe9278469c9aac231ebf89916253bdb994e9 Mon Sep 17 00:00:00 2001 From: Daniel Huigens Date: Wed, 4 Apr 2018 18:48:04 +0200 Subject: [PATCH] Don't auto-scroll unit tests if you scrolled up --- test/unittests.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/unittests.js b/test/unittests.js index 9c1c00a6..e5f89866 100644 --- a/test/unittests.js +++ b/test/unittests.js @@ -32,7 +32,13 @@ if (typeof Promise === 'undefined') { describe('Unit Tests', function () { - if (typeof window !== 'undefined') { afterEach(function () { window.scrollTo(0, document.body.scrollHeight); }); } + if (typeof window !== 'undefined') { + afterEach(function () { + if (window.scrollY >= document.body.scrollHeight - window.innerHeight - 100) { + window.scrollTo(0, document.body.scrollHeight); + } + }); + } require('./crypto'); require('./general');