本文整理汇总了TypeScript中ngx-bootstrap/datepicker.BsDatepickerModule类的典型用法代码示例。如果您正苦于以下问题:TypeScript BsDatepickerModule类的具体用法?TypeScript BsDatepickerModule怎么用?TypeScript BsDatepickerModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BsDatepickerModule类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(async(() => {
TestBed.overrideModule(BrowserDynamicTestingModule, {
set: {
entryComponents: [DynamicBootstrapInputComponent]
}
});
TestBed.configureTestingModule({
imports: [
ReactiveFormsModule,
DynamicFormsCoreModule,
TextMaskModule,
BsDatepickerModule.forRoot(),
TimepickerModule.forRoot()
],
declarations: [DynamicBootstrapFormControlContainerComponent, DynamicBootstrapInputComponent]
}).compileComponents().then(() => {
fixture = TestBed.createComponent(DynamicBootstrapFormControlContainerComponent);
component = fixture.componentInstance;
debugElement = fixture.debugElement;
});
}));
开发者ID:udos86,项目名称:ng2-dynamic-forms,代码行数:28,代码来源:dynamic-bootstrap-form-control-container.component.spec.ts
示例2: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
ReactiveFormsModule,
NoopAnimationsModule,
BsDatepickerModule.forRoot(),
TextMaskModule,
DynamicFormsCoreModule.forRoot()
],
declarations: [DynamicBootstrapDatePickerComponent]
}).compileComponents().then(() => {
fixture = TestBed.createComponent(DynamicBootstrapDatePickerComponent);
component = fixture.componentInstance;
debugElement = fixture.debugElement;
});
}));
开发者ID:thanhdevapp,项目名称:ng-dynamic-forms,代码行数:21,代码来源:dynamic-bootstrap-datepicker.component.spec.ts
示例3: describe
describe('RbdTrashMoveModalComponent', () => {
let component: RbdTrashMoveModalComponent;
let fixture: ComponentFixture<RbdTrashMoveModalComponent>;
let httpTesting: HttpTestingController;
configureTestBed({
imports: [
ReactiveFormsModule,
HttpClientTestingModule,
RouterTestingModule,
SharedModule,
ServicesModule,
ApiModule,
ToastModule.forRoot(),
BsDatepickerModule.forRoot()
],
declarations: [RbdTrashMoveModalComponent],
providers: [BsModalRef, BsModalService]
});
beforeEach(() => {
fixture = TestBed.createComponent(RbdTrashMoveModalComponent);
component = fixture.componentInstance;
httpTesting = TestBed.get(HttpTestingController);
component.metaType = 'RBD';
component.poolName = 'foo';
component.imageName = 'bar';
});
it('should create', () => {
expect(component).toBeTruthy();
expect(component.moveForm).toBeDefined();
});
it('should finish running ngOnInit', () => {
fixture.detectChanges();
expect(component.pattern).toEqual('foo/bar');
});
describe('should call moveImage', () => {
let notificationService;
beforeEach(() => {
notificationService = TestBed.get(NotificationService);
spyOn(notificationService, 'show').and.stub();
spyOn(component.modalRef, 'hide').and.callThrough();
});
afterEach(() => {
expect(notificationService.show).toHaveBeenCalledTimes(1);
expect(component.modalRef.hide).toHaveBeenCalledTimes(1);
});
it('with normal delay', () => {
component.moveImage();
const req = httpTesting.expectOne('api/block/image/foo/bar/move_trash');
req.flush(null);
expect(req.request.body).toEqual({ delay: 0 });
});
it('with delay < 0', () => {
const oldDate = moment()
.subtract(24, 'hour')
.toDate();
component.moveForm.patchValue({ expiresAt: oldDate });
component.moveImage();
const req = httpTesting.expectOne('api/block/image/foo/bar/move_trash');
req.flush(null);
expect(req.request.body).toEqual({ delay: 0 });
});
it('with delay < 0', () => {
const oldDate = moment()
.add(24, 'hour')
.toISOString();
fixture.detectChanges();
component.moveForm.patchValue({ expiresAt: oldDate });
component.moveImage();
const req = httpTesting.expectOne('api/block/image/foo/bar/move_trash');
req.flush(null);
expect(req.request.body.delay).toBeGreaterThan(86390);
});
});
});
开发者ID:dillaman,项目名称:ceph,代码行数:87,代码来源:rbd-trash-move-modal.component.spec.ts
示例4: describe
describe('LogsComponent', () => {
let component: LogsComponent;
let fixture: ComponentFixture<LogsComponent>;
configureTestBed({
imports: [
HttpClientTestingModule,
TabsModule.forRoot(),
SharedModule,
BsDatepickerModule.forRoot(),
TimepickerModule.forRoot(),
FormsModule
],
declarations: [LogsComponent]
});
beforeEach(() => {
fixture = TestBed.createComponent(LogsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe('abstractfilters', () => {
it('after initializaed', () => {
const filters = component.abstractfilters();
expect(filters.priority).toBe('All');
expect(filters.key).toBe('');
expect(filters.yearMonthDay).toBe('');
expect(filters.sTime).toBe(0);
expect(filters.eTime).toBe(1439);
});
it('change date', () => {
component.selectedDate = new Date(2019, 0, 1);
component.startTime = new Date(2019, 1, 1, 1, 10);
component.endTime = new Date(2019, 1, 1, 12, 10);
const filters = component.abstractfilters();
expect(filters.yearMonthDay).toBe('2019-01-01');
expect(filters.sTime).toBe(70);
expect(filters.eTime).toBe(730);
});
});
describe('filterLogs', () => {
const contentData = {
clog: [
{
name: 'priority',
stamp: '2019-02-21 09:39:49.572801',
message: 'Manager daemon localhost is now available',
priority: '[ERR]'
},
{
name: 'search',
stamp: '2019-02-21 09:39:49.572801',
message: 'Activating manager daemon localhost',
priority: '[INF]'
},
{
name: 'date',
stamp: '2019-01-21 09:39:49.572801',
message: 'Manager daemon localhost is now available',
priority: '[INF]'
},
{
name: 'time',
stamp: '2019-02-21 01:39:49.572801',
message: 'Manager daemon localhost is now available',
priority: '[INF]'
}
],
audit_log: []
};
const resetFilter = () => {
component.selectedDate = null;
component.priority = 'All';
component.search = '';
component.startTime.setHours(0, 0);
component.endTime.setHours(23, 59);
};
beforeEach(() => {
component.contentData = contentData;
});
it('show all log', () => {
component.filterLogs();
expect(component.clog.length).toBe(4);
});
it('filter by search key', () => {
resetFilter();
component.search = 'Activating';
component.filterLogs();
expect(component.clog.length).toBe(1);
expect(component.clog[0].name).toBe('search');
});
//.........这里部分代码省略.........
开发者ID:LenzGr,项目名称:ceph,代码行数:101,代码来源:logs.component.spec.ts
注:本文中的ngx-bootstrap/datepicker.BsDatepickerModule类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论