From 4d25a98086ed761daa67b3c28427af9f11ac347d Mon Sep 17 00:00:00 2001 From: Egor Manzhula Date: Wed, 4 Sep 2024 11:10:21 +0300 Subject: [PATCH] fix(ScrollContainer): Added testcase to test before page ready event instatntiation --- .../ScrollController/ScrollController.spec.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ilc/client/TransitionManager/ScrollController/ScrollController.spec.js b/ilc/client/TransitionManager/ScrollController/ScrollController.spec.js index 70956fa1..a074c45a 100644 --- a/ilc/client/TransitionManager/ScrollController/ScrollController.spec.js +++ b/ilc/client/TransitionManager/ScrollController/ScrollController.spec.js @@ -51,6 +51,20 @@ describe('ScrollController', () => { } }); + describe('when the ScrollController is instantiated before the page ready event', () => { + let documentBodyStub; + + beforeEach(() => { + documentBodyStub = sinon.stub(document, 'body').get(() => undefined); + scrollController = new ScrollController(); + documentBodyStub.restore(); + }); + + it('should not throw error', () => { + expect(() => scrollController.restore()).to.not.throw(); + }); + }); + it('should remove the stored hash attribute from the document body', () => { document.body.setAttribute('ilcTempStoredHash', 'testAnchor'); scrollController.restore();