fix(zone.js): add issue numbers of @types/jasmine
to the test cases (#34625)
Some cases will still need to use `spy as any` cast, because `@types/jasmine` have some issues, 1. The issue jasmine doesn't handle optional method properties, https://github.com/DefinitelyTyped/DefinitelyTyped/issues/43486 2. The issue jasmine doesn't handle overload method correctly, https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42455 PR Close #34625
This commit is contained in:

committed by
Kara Erickson

parent
b28a5f6eef
commit
421b6a97d6
@ -17,7 +17,9 @@ import {HammerGestureConfig, HammerGesturesPlugin,} from '@angular/platform-brow
|
||||
let fakeConsole: any;
|
||||
if (isNode) return;
|
||||
|
||||
beforeEach(() => { fakeConsole = {warn: jasmine.createSpy('console.warn')}; });
|
||||
beforeEach(() => {
|
||||
fakeConsole = {warn: jasmine.createSpy('console.warn')};
|
||||
});
|
||||
|
||||
describe('with no custom loader', () => {
|
||||
beforeEach(() => {
|
||||
@ -61,7 +63,9 @@ import {HammerGestureConfig, HammerGesturesPlugin,} from '@angular/platform-brow
|
||||
// Inject the NgZone so that we can make it available to the plugin through a fake
|
||||
// EventManager.
|
||||
let ngZone: NgZone;
|
||||
beforeEach(inject([NgZone], (z: NgZone) => { ngZone = z; }));
|
||||
beforeEach(inject([NgZone], (z: NgZone) => {
|
||||
ngZone = z;
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
originalHammerGlobal = (window as any).Hammer;
|
||||
@ -84,13 +88,15 @@ import {HammerGestureConfig, HammerGesturesPlugin,} from '@angular/platform-brow
|
||||
plugin = new HammerGesturesPlugin(document, hammerConfig, fakeConsole, loader);
|
||||
|
||||
// Use a fake EventManager that has access to the NgZone.
|
||||
plugin.manager = { getZone: () => ngZone } as EventManager;
|
||||
plugin.manager = {getZone: () => ngZone} as EventManager;
|
||||
|
||||
someElement = document.createElement('div');
|
||||
someListener = () => {};
|
||||
});
|
||||
|
||||
afterEach(() => { (window as any).Hammer = originalHammerGlobal; });
|
||||
afterEach(() => {
|
||||
(window as any).Hammer = originalHammerGlobal;
|
||||
});
|
||||
|
||||
it('should not log a warning when HammerJS is not loaded', () => {
|
||||
plugin.addEventListener(someElement, 'swipe', () => {});
|
||||
|
@ -51,7 +51,6 @@ import {KeyEventsPlugin} from '@angular/platform-browser/src/dom/events/key_even
|
||||
.toEqual({'domEventName': 'keydown', 'fullKey': 'control.shift'});
|
||||
expect(KeyEventsPlugin.parseEventName('keyup.control.shift'))
|
||||
.toEqual({'domEventName': 'keyup', 'fullKey': 'control.shift'});
|
||||
|
||||
});
|
||||
|
||||
it('should alias esc to escape', () => {
|
||||
@ -67,6 +66,5 @@ import {KeyEventsPlugin} from '@angular/platform-browser/src/dom/events/key_even
|
||||
expect(() => plugin.addGlobalEventListener('window', 'keyup.control.esc', () => {}))
|
||||
.not.toThrowError();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user