本文整理汇总了TypeScript中app/admin/audits/audits.component.AuditsComponent类的典型用法代码示例。如果您正苦于以下问题:TypeScript component.AuditsComponent类的具体用法?TypeScript component.AuditsComponent怎么用?TypeScript component.AuditsComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了component.AuditsComponent类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('AuditsComponent', () => {
let comp: AuditsComponent;
let fixture: ComponentFixture<AuditsComponent>;
let service: AuditsService;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [GatewayTestModule],
declarations: [AuditsComponent],
providers: [AuditsService]
})
.overrideTemplate(AuditsComponent, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AuditsComponent);
comp = fixture.componentInstance;
service = fixture.debugElement.injector.get(AuditsService);
});
describe('today function ', () => {
it('should set toDate to current date', () => {
comp.today();
expect(comp.toDate).toBe(getDate());
});
});
describe('previousMonth function ', () => {
it('should set fromDate to current date', () => {
comp.previousMonth();
expect(comp.fromDate).toBe(getDate(false));
});
});
describe('By default, on init', () => {
it('should set all default values correctly', () => {
fixture.detectChanges();
expect(comp.toDate).toBe(getDate());
expect(comp.fromDate).toBe(getDate(false));
expect(comp.itemsPerPage).toBe(ITEMS_PER_PAGE);
expect(comp.page).toBe(10);
expect(comp.reverse).toBeFalsy();
expect(comp.predicate).toBe('id');
});
});
describe('OnInit', () => {
it('Should call load all on init', () => {
// GIVEN
const headers = new HttpHeaders().append('link', 'link;link');
const audit = new Audit({ remoteAddress: '127.0.0.1', sessionId: '123' }, 'user', '20140101', 'AUTHENTICATION_SUCCESS');
spyOn(service, 'query').and.returnValue(
of(
new HttpResponse({
body: [audit],
headers
})
)
);
// WHEN
comp.ngOnInit();
// THEN
expect(service.query).toHaveBeenCalled();
expect(comp.audits[0]).toEqual(jasmine.objectContaining(audit));
});
});
describe('Create sort object', () => {
it('Should sort only by id asc', () => {
// GIVEN
comp.predicate = 'id';
comp.reverse = false;
// WHEN
const sort = comp.sort();
// THEN
expect(sort.length).toEqual(1);
expect(sort[0]).toEqual('id,desc');
});
it('Should sort by timestamp asc then by id', () => {
// GIVEN
comp.predicate = 'timestamp';
comp.reverse = true;
// WHEN
const sort = comp.sort();
// THEN
expect(sort.length).toEqual(2);
expect(sort[0]).toEqual('timestamp,asc');
expect(sort[1]).toEqual('id');
});
});
});
开发者ID:timofeev-denis,项目名称:Java,代码行数:99,代码来源:audits.component.spec.ts
示例2: it
it('Should sort only by id asc', () => {
// GIVEN
comp.predicate = 'id';
comp.reverse = false;
// WHEN
const sort = comp.sort();
// THEN
expect(sort.length).toEqual(1);
expect(sort[0]).toEqual('id,desc');
});
开发者ID:timofeev-denis,项目名称:Java,代码行数:12,代码来源:audits.component.spec.ts
示例3: HttpResponse
it('Should call load all on init', () => {
// GIVEN
const headers = new HttpHeaders().append('link', 'link;link');
const audit = new Audit({ remoteAddress: '127.0.0.1', sessionId: '123' }, 'user', '20140101', 'AUTHENTICATION_SUCCESS');
spyOn(service, 'query').and.returnValue(
of(
new HttpResponse({
body: [audit],
headers
})
)
);
// WHEN
comp.ngOnInit();
// THEN
expect(service.query).toHaveBeenCalled();
expect(comp.audits[0]).toEqual(jasmine.objectContaining(audit));
});
开发者ID:timofeev-denis,项目名称:Java,代码行数:20,代码来源:audits.component.spec.ts
注:本文中的app/admin/audits/audits.component.AuditsComponent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论