
Previously, due ot a limitation/bug in AoT compilation and `useValue`, the `global` injected into `SwUpdateNotificationsService` was always undefined, which prevented it from actually reloading the page after activating a ServiceWorker update. This commit fixes it by switching to `useFactory`, which works correctly with AoT.
19 lines
374 B
TypeScript
19 lines
374 B
TypeScript
import { ReflectiveInjector } from '@angular/core';
|
|
|
|
import { Global, globalProvider } from './global.value';
|
|
|
|
|
|
describe('Global', () => {
|
|
let value: any;
|
|
|
|
beforeEach(() => {
|
|
const injector = ReflectiveInjector.resolveAndCreate([globalProvider]);
|
|
value = injector.get(Global);
|
|
});
|
|
|
|
|
|
it('should be `window`', () => {
|
|
expect(value).toBe(window);
|
|
});
|
|
});
|