Created
May 18, 2022 18:59
-
-
Save gparlakov/3fac7f2a07f6c49448fc0c559eb1685f to your computer and use it in GitHub Desktop.
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
it('when clicked on the second point should NOT navigate to show the selected point if it is NOT visible', () => { | |
// arrange | |
const r = mockRouter(); | |
// arrange the onclick prerequisites | |
const ch = jasmine.createSpy('chart builder'); | |
let onClickCallback: Function = () => {}; | |
ch.and.callFake((i, o) => { | |
onClickCallback = o.options.onClick; | |
return { | |
// mock the isVisible method | |
getDataVisibility: jasmine | |
.createSpy('isVisibleMockMethod') | |
.and.returnValue(false), | |
}; | |
}); | |
const c = new ChartComponent(r, ch); | |
c.canvas = new ElementRef(document.createElement('canvas')); | |
c.ngAfterViewInit(); | |
// act | |
onClickCallback(null, [{ index: 1 }]); | |
// assert | |
expect(r.navigate).not.toHaveBeenCalledWith([2]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment