SecurityService.prototype.Feedback = function () {
window.open('https://www.google.com/', '_blank');
I need to write the test case for above code in Jasmine in Angular 2.
I'd recommend you to use $window
instead of window.
If you do that, you can easily test it like this:
spyOn($window, 'open');
//call your function here
expect($window.open).toHaveBeenCalledWith('https://www.google.com/', '_blank');
Hope that helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.