fix(service-worker): add missing annotation for SwPush (#19721)
PR Close #19721
This commit is contained in:
parent
9723a362b6
commit
15a8429b96
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Subject} from 'rxjs/Subject';
|
||||
|
||||
|
@ -23,6 +24,7 @@ import {NgswCommChannel} from './low_level';
|
|||
*
|
||||
* @experimental
|
||||
*/
|
||||
@Injectable()
|
||||
export class SwPush {
|
||||
readonly messages: Observable<object>;
|
||||
readonly subscription: Observable<PushSubscription|null>;
|
||||
|
@ -79,4 +81,4 @@ export class SwPush {
|
|||
const unsubscribeOnce = op_take.call(unsubscribe, 1);
|
||||
return op_toPromise.call(unsubscribeOnce) as Promise<void>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
import 'rxjs/add/operator/toPromise';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
|
||||
import {NgswCommChannel} from '../src/low_level';
|
||||
import {SwPush} from '../src/push';
|
||||
|
@ -41,7 +42,7 @@ export function main() {
|
|||
mock.setupSw();
|
||||
});
|
||||
});
|
||||
describe('NgswPush', () => {
|
||||
describe('SwPush', () => {
|
||||
let push: SwPush;
|
||||
let reg: MockServiceWorkerRegistration;
|
||||
beforeEach((done: DoneFn) => {
|
||||
|
@ -63,8 +64,17 @@ export function main() {
|
|||
},
|
||||
});
|
||||
});
|
||||
it('is injectable', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
SwPush,
|
||||
{provide: NgswCommChannel, useValue: comm},
|
||||
]
|
||||
});
|
||||
expect(() => TestBed.get(SwPush)).not.toThrow();
|
||||
});
|
||||
});
|
||||
describe('NgswUpdate', () => {
|
||||
describe('SwUpdate', () => {
|
||||
let update: SwUpdate;
|
||||
let reg: MockServiceWorkerRegistration;
|
||||
beforeEach((done: DoneFn) => {
|
||||
|
@ -132,6 +142,15 @@ export function main() {
|
|||
.then(() => done())
|
||||
.catch(err => done.fail(err));
|
||||
});
|
||||
it('is injectable', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
SwUpdate,
|
||||
{provide: NgswCommChannel, useValue: comm},
|
||||
]
|
||||
});
|
||||
expect(() => TestBed.get(SwUpdate)).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue