Created
April 13, 2022 23:05
-
-
Save venuduggireddy/63f1231f8d2a9cc6322545b7c3be127b to your computer and use it in GitHub Desktop.
Angular unit test document.querySelector('') and scrollIntoView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//document.querySelector('#elId').scrollIntoView({ behavior: 'smooth'}); | |
it('Sidenav Clicked navigate to route "Subawards', () => { | |
const mSpy = spyOn(component, 'clicked').and.callThrough(); | |
let divElement = document.createElement('div'); | |
divElement.setAttribute('id', "header"); | |
spyOn(document, 'querySelector').and.returnValue(divElement); | |
component.clicked({ 'mode': 0, 'path': '#header' }); | |
expect(mSpy).toHaveBeenCalled(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment