本文整理汇总了TypeScript中app/admin/user-management/user-management.component.UserMgmtComponent类的典型用法代码示例。如果您正苦于以下问题:TypeScript component.UserMgmtComponent类的具体用法?TypeScript component.UserMgmtComponent怎么用?TypeScript component.UserMgmtComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了component.UserMgmtComponent类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('User Management Component', () => {
let comp: UserMgmtComponent;
let fixture: ComponentFixture<UserMgmtComponent>;
let service: UserService;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [JhipsterSampleApplicationTestModule],
declarations: [UserMgmtComponent]
})
.overrideTemplate(UserMgmtComponent, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserMgmtComponent);
comp = fixture.componentInstance;
service = fixture.debugElement.injector.get(UserService);
});
describe('OnInit', () => {
it('Should call load all on init', inject(
[],
fakeAsync(() => {
// GIVEN
const headers = new HttpHeaders().append('link', 'link;link');
spyOn(service, 'query').and.returnValue(
of(
new HttpResponse({
body: [new User(123)],
headers
})
)
);
// WHEN
comp.ngOnInit();
tick(); // simulate async
// THEN
expect(service.query).toHaveBeenCalled();
expect(comp.users[0]).toEqual(jasmine.objectContaining({ id: 123 }));
})
));
});
describe('setActive', () => {
it('Should update user and call load all', inject(
[],
fakeAsync(() => {
// GIVEN
const headers = new HttpHeaders().append('link', 'link;link');
const user = new User(123);
spyOn(service, 'query').and.returnValue(
of(
new HttpResponse({
body: [user],
headers
})
)
);
spyOn(service, 'update').and.returnValue(of(new HttpResponse({ status: 200 })));
// WHEN
comp.setActive(user, true);
tick(); // simulate async
// THEN
expect(service.update).toHaveBeenCalledWith(user);
expect(service.query).toHaveBeenCalled();
expect(comp.users[0]).toEqual(jasmine.objectContaining({ id: 123 }));
})
));
});
});
开发者ID:EugeneGoroschenya,项目名称:jhipster-sample-application,代码行数:75,代码来源:user-management.component.spec.ts
示例2: HttpResponse
fakeAsync(() => {
// GIVEN
const headers = new HttpHeaders().append('link', 'link;link');
spyOn(service, 'query').and.returnValue(
of(
new HttpResponse({
body: [new User(123)],
headers
})
)
);
// WHEN
comp.ngOnInit();
tick(); // simulate async
// THEN
expect(service.query).toHaveBeenCalled();
expect(comp.users[0]).toEqual(jasmine.objectContaining({ id: 123 }));
})
开发者ID:EugeneGoroschenya,项目名称:jhipster-sample-application,代码行数:20,代码来源:user-management.component.spec.ts
注:本文中的app/admin/user-management/user-management.component.UserMgmtComponent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论