本文整理汇总了TypeScript中ngx-bootstrap/popover.PopoverModule类的典型用法代码示例。如果您正苦于以下问题:TypeScript PopoverModule类的具体用法?TypeScript PopoverModule怎么用?TypeScript PopoverModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PopoverModule类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('HealthComponent', () => {
let component: HealthComponent;
let fixture: ComponentFixture<HealthComponent>;
configureTestBed({
providers: [DashboardService],
imports: [SharedModule, HttpClientTestingModule, PopoverModule.forRoot()],
declarations: [
HealthComponent,
MonSummaryPipe,
OsdSummaryPipe,
MdsSummaryPipe,
MgrSummaryPipe,
PgStatusStylePipe,
LogColorPipe,
PgStatusPipe
],
schemas: [NO_ERRORS_SCHEMA]
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
开发者ID:neha-ojha,项目名称:ceph,代码行数:30,代码来源:health.component.spec.ts
示例2: async
async(() => {
TestBed.configureTestingModule({
imports: [PopoverModule.forRoot(), SharedModule],
declarations: [NotificationsComponent],
providers: [{ provide: NotificationService, useValue: fakeService }]
}).compileComponents();
})
开发者ID:Abhishekvrshny,项目名称:ceph,代码行数:7,代码来源:notifications.component.spec.ts
示例3: describe
describe('SelectBadgesComponent', () => {
let component: SelectBadgesComponent;
let fixture: ComponentFixture<SelectBadgesComponent>;
configureTestBed({
declarations: [SelectBadgesComponent, SelectComponent],
imports: [PopoverModule.forRoot(), TooltipModule, ReactiveFormsModule],
providers: i18nProviders
});
beforeEach(() => {
fixture = TestBed.createComponent(SelectBadgesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should reflect the attributes into CdSelect', () => {
const data = ['a', 'b'];
const options = [
{ name: 'option1', description: '', selected: false, enabled: true },
{ name: 'option2', description: '', selected: false, enabled: true }
];
const i18n = TestBed.get(I18n);
const messages = new SelectMessages({ empty: 'foo bar' }, i18n);
const selectionLimit = 2;
const customBadges = true;
const customBadgeValidators = [Validators.required];
component.data = data;
component.options = options;
component.messages = messages;
component.selectionLimit = selectionLimit;
component.customBadges = customBadges;
component.customBadgeValidators = customBadgeValidators;
fixture.detectChanges();
expect(component.cdSelect.data).toEqual(data);
expect(component.cdSelect.options).toEqual(options);
expect(component.cdSelect.messages).toEqual(messages);
expect(component.cdSelect.selectionLimit).toEqual(selectionLimit);
expect(component.cdSelect.customBadges).toEqual(customBadges);
expect(component.cdSelect.customBadgeValidators).toEqual(customBadgeValidators);
});
});
开发者ID:LenzGr,项目名称:ceph,代码行数:49,代码来源:select-badges.component.spec.ts
示例4: async
async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule,
RouterTestingModule,
HttpClientTestingModule,
PopoverModule.forRoot()
],
declarations: [
NavigationComponent,
NotificationsComponent,
LogoutComponent,
TaskManagerComponent
],
providers: [{ provide: NotificationService, useValue: fakeService }]
}).compileComponents();
})
开发者ID:Abhishekvrshny,项目名称:ceph,代码行数:17,代码来源:navigation.component.spec.ts
示例5: describe
describe('NotificationsComponent', () => {
let component: NotificationsComponent;
let fixture: ComponentFixture<NotificationsComponent>;
configureTestBed({
imports: [PopoverModule.forRoot(), SharedModule, ToastModule.forRoot()],
declarations: [NotificationsComponent]
});
beforeEach(() => {
fixture = TestBed.createComponent(NotificationsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
开发者ID:C2python,项目名称:ceph,代码行数:19,代码来源:notifications.component.spec.ts
示例6: describe
describe('HealthComponent', () => {
let component: HealthComponent;
let fixture: ComponentFixture<HealthComponent>;
let getHealthSpy;
const healthPayload = {
health: { status: 'HEALTH_OK' },
mon_status: { monmap: { mons: [] }, quorum: [] },
osd_map: { osds: [] },
mgr_map: { standbys: [] },
hosts: 0,
rgw: 0,
fs_map: { filesystems: [] },
iscsi_daemons: 0,
client_perf: {},
scrub_status: 'Inactive',
pools: [],
df: { stats: { total_objects: 0 } },
pg_info: {}
};
configureTestBed({
imports: [SharedModule, HttpClientTestingModule, PopoverModule.forRoot()],
declarations: [
HealthComponent,
MonSummaryPipe,
OsdSummaryPipe,
MdsSummaryPipe,
MgrSummaryPipe,
PgStatusStylePipe,
LogColorPipe,
PgStatusPipe
],
schemas: [NO_ERRORS_SCHEMA]
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthComponent);
component = fixture.componentInstance;
getHealthSpy = spyOn(TestBed.get(DashboardService), 'getHealth');
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should render all info groups and all info cards', () => {
getHealthSpy.and.returnValue(of(healthPayload));
fixture.detectChanges();
const infoGroups = fixture.debugElement.nativeElement.querySelectorAll('cd-info-group');
expect(infoGroups.length).toBe(3);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
expect(infoCards.length).toBe(18);
});
it('should render all except "Status" group and cards', () => {
const payload = _.cloneDeep(healthPayload);
payload.health.status = '';
payload.mon_status = null;
payload.osd_map = null;
payload.mgr_map = null;
payload.hosts = null;
payload.rgw = null;
payload.fs_map = null;
payload.iscsi_daemons = null;
getHealthSpy.and.returnValue(of(payload));
fixture.detectChanges();
const infoGroups = fixture.debugElement.nativeElement.querySelectorAll('cd-info-group');
expect(infoGroups.length).toBe(2);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
expect(infoCards.length).toBe(10);
});
it('should render all except "Performance" group and cards', () => {
const payload = _.cloneDeep(healthPayload);
payload.scrub_status = '';
payload.client_perf = null;
getHealthSpy.and.returnValue(of(payload));
fixture.detectChanges();
const infoGroups = fixture.debugElement.nativeElement.querySelectorAll('cd-info-group');
expect(infoGroups.length).toBe(2);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
expect(infoCards.length).toBe(13);
});
it('should render all except "Capacity" group and cards', () => {
const payload = _.cloneDeep(healthPayload);
payload.pools = null;
payload.df = null;
payload.pg_info = null;
getHealthSpy.and.returnValue(of(payload));
fixture.detectChanges();
//.........这里部分代码省略.........
开发者ID:C2python,项目名称:ceph,代码行数:101,代码来源:health.component.spec.ts
示例7: describe
describe('HealthComponent', () => {
let component: HealthComponent;
let fixture: ComponentFixture<HealthComponent>;
let getHealthSpy;
const healthPayload = {
health: { status: 'HEALTH_OK' },
mon_status: { monmap: { mons: [] }, quorum: [] },
osd_map: { osds: [] },
mgr_map: { standbys: [] },
hosts: 0,
rgw: 0,
fs_map: { filesystems: [] },
iscsi_daemons: 0,
client_perf: {},
scrub_status: 'Inactive',
pools: [],
df: { stats: { total_objects: 0 } },
pg_info: {}
};
const fakeAuthStorageService = {
getPermissions: () => {
return new Permissions({ log: ['read'] });
}
};
configureTestBed({
imports: [SharedModule, HttpClientTestingModule, PopoverModule.forRoot()],
declarations: [
HealthComponent,
MonSummaryPipe,
OsdSummaryPipe,
MdsSummaryPipe,
MgrSummaryPipe,
PgStatusStylePipe,
PgStatusPipe
],
schemas: [NO_ERRORS_SCHEMA],
providers: [i18nProviders, { provide: AuthStorageService, useValue: fakeAuthStorageService }]
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthComponent);
component = fixture.componentInstance;
getHealthSpy = spyOn(TestBed.get(HealthService), 'getMinimalHealth');
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should render all info groups and all info cards', () => {
getHealthSpy.and.returnValue(of(healthPayload));
fixture.detectChanges();
const infoGroups = fixture.debugElement.nativeElement.querySelectorAll('cd-info-group');
expect(infoGroups.length).toBe(3);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
expect(infoCards.length).toBe(18);
});
it('should render all except "Status" group and cards', () => {
const payload = _.cloneDeep(healthPayload);
payload.health.status = '';
payload.mon_status = null;
payload.osd_map = null;
payload.mgr_map = null;
payload.hosts = null;
payload.rgw = null;
payload.fs_map = null;
payload.iscsi_daemons = null;
getHealthSpy.and.returnValue(of(payload));
fixture.detectChanges();
const infoGroups = fixture.debugElement.nativeElement.querySelectorAll('cd-info-group');
expect(infoGroups.length).toBe(2);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
expect(infoCards.length).toBe(10);
});
it('should render all except "Performance" group and cards', () => {
const payload = _.cloneDeep(healthPayload);
payload.scrub_status = '';
payload.client_perf = null;
getHealthSpy.and.returnValue(of(payload));
fixture.detectChanges();
const infoGroups = fixture.debugElement.nativeElement.querySelectorAll('cd-info-group');
expect(infoGroups.length).toBe(2);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
expect(infoCards.length).toBe(13);
});
it('should render all except "Capacity" group and cards', () => {
const payload = _.cloneDeep(healthPayload);
payload.pools = null;
//.........这里部分代码省略.........
开发者ID:markhpc,项目名称:ceph,代码行数:101,代码来源:health.component.spec.ts
示例8: describe
describe('ConfigOptionComponent', () => {
let component: ConfigOptionComponent;
let fixture: ComponentFixture<ConfigOptionComponent>;
let configurationService: ConfigurationService;
let oNames: Array<string>;
configureTestBed({
declarations: [ConfigOptionComponent, HelperComponent],
imports: [PopoverModule.forRoot(), ReactiveFormsModule, HttpClientTestingModule],
providers: [ConfigurationService]
});
beforeEach(() => {
fixture = TestBed.createComponent(ConfigOptionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
configurationService = TestBed.get(ConfigurationService);
const configOptions = [
{
name: 'osd_scrub_auto_repair_num_errors',
type: 'uint',
level: 'advanced',
desc: 'Maximum number of detected errors to automatically repair',
long_desc: '',
default: 5,
daemon_default: '',
tags: [],
services: [],
see_also: ['osd_scrub_auto_repair'],
min: '',
max: '',
can_update_at_runtime: true,
flags: []
},
{
name: 'osd_debug_deep_scrub_sleep',
type: 'float',
level: 'dev',
desc:
'Inject an expensive sleep during deep scrub IO to make it easier to induce preemption',
long_desc: '',
default: 0,
daemon_default: '',
tags: [],
services: [],
see_also: [],
min: '',
max: '',
can_update_at_runtime: true,
flags: []
},
{
name: 'osd_heartbeat_interval',
type: 'int',
level: 'advanced',
desc: 'Interval (in seconds) between peer pings',
long_desc: '',
default: 6,
daemon_default: '',
tags: [],
services: [],
see_also: [],
min: 1,
max: 86400,
can_update_at_runtime: true,
flags: [],
value: [
{
section: 'osd',
value: 6
}
]
},
{
name: 'bluestore_compression_algorithm',
type: 'str',
level: 'advanced',
desc: 'Default compression algorithm to use when writing object data',
long_desc:
'This controls the default compressor to use (if any) if the ' +
'per-pool property is not set. Note that zstd is *not* recommended for ' +
'bluestore due to high CPU overhead when compressing small amounts of data.',
default: 'snappy',
daemon_default: '',
tags: [],
services: [],
see_also: [],
enum_values: ['', 'snappy', 'zlib', 'zstd', 'lz4'],
min: '',
max: '',
can_update_at_runtime: true,
flags: ['runtime']
},
{
name: 'rbd_discard_on_zeroed_write_same',
type: 'bool',
level: 'advanced',
desc: 'discard data on zeroed write same instead of writing zero',
long_desc: '',
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:
示例9: describe
describe('SelectComponent', () => {
let component: SelectComponent;
let fixture: ComponentFixture<SelectComponent>;
const selectOption = (filter: string) => {
component.filter.setValue(filter);
component.updateFilter();
component.selectOption();
};
configureTestBed({
declarations: [SelectComponent],
imports: [PopoverModule.forRoot(), TooltipModule, ReactiveFormsModule],
providers: i18nProviders
});
beforeEach(() => {
fixture = TestBed.createComponent(SelectComponent);
component = fixture.componentInstance;
fixture.detectChanges();
component.options = [
{ name: 'option1', description: '', selected: false },
{ name: 'option2', description: '', selected: false },
{ name: 'option3', description: '', selected: false }
];
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should add item', () => {
component.data = [];
component.triggerSelection(component.options[1]);
expect(component.data).toEqual(['option2']);
});
it('should update selected', () => {
component.data = ['option2'];
component.ngOnChanges();
expect(component.options[0].selected).toBe(false);
expect(component.options[1].selected).toBe(true);
});
it('should remove item', () => {
component.options.map((option) => {
option.selected = true;
return option;
});
component.data = ['option1', 'option2', 'option3'];
component.removeItem('option1');
expect(component.data).toEqual(['option2', 'option3']);
});
it('should not remove item that is not selected', () => {
component.options[0].selected = true;
component.data = ['option1'];
component.removeItem('option2');
expect(component.data).toEqual(['option1']);
});
describe('filter values', () => {
beforeEach(() => {
component.ngOnInit();
});
it('shows all options with no value set', () => {
expect(component.filteredOptions).toEqual(component.options);
});
it('shows one option that it filtered for', () => {
component.filter.setValue('2');
component.updateFilter();
expect(component.filteredOptions).toEqual([component.options[1]]);
});
it('shows all options after selecting something', () => {
component.filter.setValue('2');
component.updateFilter();
component.selectOption();
expect(component.filteredOptions).toEqual(component.options);
});
it('is not able to create by default with no value set', () => {
component.updateFilter();
expect(component.isCreatable()).toBeFalsy();
});
it('is not able to create by default with a value set', () => {
component.filter.setValue('2');
component.updateFilter();
expect(component.isCreatable()).toBeFalsy();
});
});
describe('automatically add selected options if not in options array', () => {
beforeEach(() => {
component.data = ['option1', 'option4'];
expect(component.options.length).toBe(3);
});
//.........这里部分代码省略.........
开发者ID:IlsooByun,项目名称:ceph,代码行数:101,代码来源:select.component.spec.ts
示例10: describe
describe('HealthComponent', () => {
let component: HealthComponent;
let fixture: ComponentFixture<HealthComponent>;
let getHealthSpy;
const healthPayload = {
health: { status: 'HEALTH_OK' },
mon_status: { monmap: { mons: [] }, quorum: [] },
osd_map: { osds: [] },
mgr_map: { standbys: [] },
hosts: 0,
rgw: 0,
fs_map: { filesystems: [] },
iscsi_daemons: 0,
client_perf: {},
scrub_status: 'Inactive',
pools: [],
df: { stats: { total_objects: 0 } },
pg_info: {}
};
const fakeAuthStorageService = {
getPermissions: () => {
return new Permissions({ log: ['read'] });
}
};
let fakeFeatureTogglesService;
configureTestBed({
imports: [SharedModule, HttpClientTestingModule, PopoverModule.forRoot()],
declarations: [
HealthComponent,
HealthPieComponent,
MonSummaryPipe,
OsdSummaryPipe,
MdsSummaryPipe,
MgrSummaryPipe
],
schemas: [NO_ERRORS_SCHEMA],
providers: [
i18nProviders,
{ provide: AuthStorageService, useValue: fakeAuthStorageService },
PgCategoryService,
RefreshIntervalService
]
});
beforeEach(() => {
fakeFeatureTogglesService = spyOn(TestBed.get(FeatureTogglesService), 'get').and.returnValue(
of({
rbd: true,
mirroring: true,
iscsi: true,
cephfs: true,
rgw: true
})
);
fixture = TestBed.createComponent(HealthComponent);
component = fixture.componentInstance;
getHealthSpy = spyOn(TestBed.get(HealthService), 'getMinimalHealth');
getHealthSpy.and.returnValue(of(healthPayload));
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should render all info groups and all info cards', () => {
fixture.detectChanges();
const infoGroups = fixture.debugElement.nativeElement.querySelectorAll('cd-info-group');
expect(infoGroups.length).toBe(3);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
expect(infoCards.length).toBe(18);
});
describe('features disabled', () => {
beforeEach(() => {
fakeFeatureTogglesService.and.returnValue(
of({
rbd: false,
mirroring: false,
iscsi: false,
cephfs: false,
rgw: false
})
);
fixture = TestBed.createComponent(HealthComponent);
component = fixture.componentInstance;
});
it('should not render cards related to disabled features', () => {
fixture.detectChanges();
const infoGroups = fixture.debugElement.nativeElement.querySelectorAll('cd-info-group');
expect(infoGroups.length).toBe(3);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
expect(infoCards.length).toBe(15);
});
});
//.........这里部分代码省略.........
开发者ID:LenzGr,项目名称:ceph,代码行数:101,代码来源:health.component.spec.ts
示例11: describe
describe('TaskManagerComponent', () => {
let component: TaskManagerComponent;
let fixture: ComponentFixture<TaskManagerComponent>;
const tasks = {
executing: [],
finished: []
};
configureTestBed({
imports: [SharedModule, PopoverModule.forRoot(), HttpClientTestingModule, RouterTestingModule],
declarations: [TaskManagerComponent],
providers: [i18nProviders]
});
beforeEach(() => {
fixture = TestBed.createComponent(TaskManagerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
tasks.executing = [
new ExecutingTask('rbd/delete', {
pool_name: 'somePool',
image_name: 'someImage'
})
];
tasks.finished = [
new FinishedTask('rbd/copy', {
dest_pool_name: 'somePool',
dest_image_name: 'someImage'
}),
new FinishedTask('rbd/clone', {
child_pool_name: 'somePool',
child_image_name: 'someImage'
})
];
tasks.finished[1].success = false;
tasks.finished[1].exception = { code: 17 };
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should get executing message for task', () => {
component._handleTasks(tasks.executing, []);
expect(component.executingTasks.length).toBe(1);
expect(component.executingTasks[0].description).toBe(`Deleting RBD 'somePool/someImage'`);
});
it('should get finished message for successful task', () => {
component._handleTasks([], tasks.finished);
expect(component.finishedTasks.length).toBe(2);
expect(component.finishedTasks[0].description).toBe(`Copied RBD 'somePool/someImage'`);
expect(component.finishedTasks[0].errorMessage).toBe(undefined);
});
it('should get failed message for finished task', () => {
component._handleTasks([], tasks.finished);
expect(component.finishedTasks.length).toBe(2);
expect(component.finishedTasks[1].description).toBe(`Failed to clone RBD 'somePool/someImage'`);
expect(component.finishedTasks[1].errorMessage).toBe(
`Name is already used by RBD 'somePool/someImage'.`
);
});
it('should get an empty hour glass with only finished tasks', () => {
component._setIcon(0);
expect(component.icon).toBe('fa-hourglass-o');
});
it('should get a nearly empty hour glass with executing tasks', () => {
component._setIcon(10);
expect(component.icon).toBe('fa-hourglass-start');
});
});
开发者ID:IlsooByun,项目名称:ceph,代码行数:74,代码来源:task-manager.component.spec.ts
示例12: describe
describe('NotificationsComponent', () => {
let component: NotificationsComponent;
let fixture: ComponentFixture<NotificationsComponent>;
configureTestBed({
imports: [
HttpClientTestingModule,
PopoverModule.forRoot(),
SharedModule,
ToastModule.forRoot()
],
declarations: [NotificationsComponent],
providers: i18nProviders
});
beforeEach(() => {
fixture = TestBed.createComponent(NotificationsComponent);
component = fixture.componentInstance;
});
it('should create', () => {
fixture.detectChanges();
expect(component).toBeTruthy();
});
describe('prometheus alert handling', () => {
let prometheusAlertService: PrometheusAlertService;
let prometheusNotificationService: PrometheusNotificationService;
let prometheusAccessAllowed: boolean;
const expectPrometheusServicesToBeCalledTimes = (n: number) => {
expect(prometheusNotificationService.refresh).toHaveBeenCalledTimes(n);
expect(prometheusAlertService.refresh).toHaveBeenCalledTimes(n);
};
beforeEach(() => {
prometheusAccessAllowed = true;
spyOn(TestBed.get(AuthStorageService), 'getPermissions').and.callFake(() => ({
prometheus: { read: prometheusAccessAllowed }
}));
spyOn(TestBed.get(PrometheusService), 'ifAlertmanagerConfigured').and.callFake((fn) => fn());
prometheusAlertService = TestBed.get(PrometheusAlertService);
spyOn(prometheusAlertService, 'refresh').and.stub();
prometheusNotificationService = TestBed.get(PrometheusNotificationService);
spyOn(prometheusNotificationService, 'refresh').and.stub();
});
it('should not refresh prometheus services if not allowed', () => {
prometheusAccessAllowed = false;
fixture.detectChanges();
expectPrometheusServicesToBeCalledTimes(0);
});
it('should first refresh prometheus notifications and alerts during init', () => {
fixture.detectChanges();
expect(prometheusAlertService.refresh).toHaveBeenCalledTimes(1);
expectPrometheusServicesToBeCalledTimes(1);
});
it('should refresh prometheus services every 5s', fakeAsync(() => {
fixture.detectChanges();
expectPrometheusServicesToBeCalledTimes(1);
tick(5000);
expectPrometheusServicesToBeCalledTimes(2);
tick(15000);
expectPrometheusServicesToBeCalledTimes(5);
component.ngOnDestroy();
}));
});
});
开发者ID:IlsooByun,项目名称:ceph,代码行数:75,代码来源:notifications.component.spec.ts
注:本文中的ngx-bootstrap/popover.PopoverModule类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论