Skip to content

Commit

Permalink
fix(ScrollContainer): Added testcase to test before page ready event …
Browse files Browse the repository at this point in the history
…instatntiation
  • Loading branch information
Egor Manzhula committed Sep 4, 2024
1 parent c33a651 commit 4d25a98
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4d25a98

Please sign in to comment.