本文整理匯總了TypeScript中rxjs/internal/observable/of.of函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript of函數的具體用法?TypeScript of怎麽用?TypeScript of使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了of函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor() {
this.rooms = of([{
id: '1',
title: 'Star Fox' ,
picture: '.jpg'
},
{
id: '2',
title: 'Zelda',
picture: '.jpg'
},
{
id: '3',
title: 'Donkey Kong',
picture: '.jpg'
},
{
id: '4',
title: 'Sim City',
picture: '.jpg',
},
{
id: '5',
title: 'Halo',
picture: '.jpg',
}]);
}
示例2: it
it('should disabled when just hava the default device', () => {
spyOn(dotDeviceService, 'get').and.returnValue(of([]));
fixture.detectChanges();
const pDropDown: DebugElement = de.query(By.css('p-dropdown'));
expect(pDropDown.componentInstance.disabled).toBeTruthy();
});
示例3: it
it('should not execute recaptcha when captcha is disabled', () => {
component.teamName = 'some team';
component.password = 'some password';
const captchaResponse: HttpResponse<string> = new HttpResponse({
body: JSON.stringify({captchaEnabled: false})
});
mockTeamService.isCaptchaEnabledForTeam.and.returnValue(of(captchaResponse));
component.requestCaptchaStateAndLogIn();
expect(mockTeamService.login).toHaveBeenCalled();
expect(mockRecaptchaComponent.execute).not.toHaveBeenCalled();
});
示例4: it
it('should set jwt as cookie and navigate to team page when captcha is disabled', () => {
component.teamName = 'Team Name';
component.password = 'p4ssw0rd';
component.confirmPassword = 'p4ssw0rd';
const teamUrl = 'team/teamId';
const jwt = 'im.a.jwt';
const createTeamResponse: HttpResponse<string> = new HttpResponse({
body: jwt,
headers: new HttpHeaders({location: teamUrl})
});
const captchaResponse: HttpResponse<string> = new HttpResponse({
body: JSON.stringify({captchaEnabled: false})
});
mockTeamService.isCaptchaEnabled.and.returnValue(of(captchaResponse));
mockTeamService.create.and.returnValue(of(createTeamResponse));
component.requestCaptchaStateAndCreateTeam();
expect(AuthService.setToken).toHaveBeenCalledWith(jwt);
expect(mockRouter.navigateByUrl).toHaveBeenCalledWith(teamUrl);
});
示例5: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MaterialMock, MaterialTextfieldMock, SettingsGeneralComponent],
imports: [RouterTestingModule, ReactiveFormsModule, CommonModule, FormsModule],
providers: [
{ provide: Session, useValue: sessionMock },
{ provide: Client, useValue: clientMock },
{ provide: ThirdPartyNetworksService, useValue: thirdPartyNetworksServiceMock },
{ provide: ActivatedRoute, useValue: { params: of({ 'guid': '1000' }) } },
{ provide: Router, useValue: routerMock },
]
})
.compileComponents();
}));
示例6: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
TokenPipe,
MockComponent({ selector: 'm-wire-console--overview'}),
MockComponent({ selector: 'm-wallet--balance-usd'}),
MockComponent({ selector: 'm-wallet--balance-rewards'}),
MockComponent({ selector: 'm-wallet--balance-tokens'}),
WalletOverviewComponent
],
providers: [
{ provide: Client, useValue: clientMock },
{ provide: WalletService, useValue: WalletServiceMock },
{ provide: BlockchainService, useValue: blockchainService },
{ provide: Router, useValue: RouterTestingModule },
{ provide: MindsTitle, useValue: MockService(MindsTitle) },
{ provide: Session, useValue: sessionMock },
{ provide: Storage, useValue: storageMock },
{ provide: ActivatedRoute, useValue: { url: of([{ path: 'newsfeed' }]), params: of({ filter: 'trending' }) } }
]
})
.compileComponents(); // compile template and css
}));
示例7: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
MockDirective({ selector: '[mdl]', inputs: ['mdl'] }),
MockComponent({ selector: 'minds-card', inputs: ['object', 'hostClass'] }),
MockComponent({ selector: 'minds-button', inputs: ['object', 'type'] }),
BoostConsoleBooster
],
imports: [RouterTestingModule, ReactiveFormsModule],
providers: [
{ provide: Client, useValue: clientMock },
{ provide: Session, useValue: sessionMock },
{ provide: ActivatedRoute, useValue: { parent: { url: of([{ path: 'newsfeed' }]) } } }
]
})
.compileComponents();
}));