當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript PopoverModule.forRoot方法代碼示例

本文整理匯總了TypeScript中ngx-bootstrap/popover.PopoverModule.forRoot方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript PopoverModule.forRoot方法的具體用法?TypeScript PopoverModule.forRoot怎麽用?TypeScript PopoverModule.forRoot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ngx-bootstrap/popover.PopoverModule的用法示例。


在下文中一共展示了PopoverModule.forRoot方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的ngx-bootstrap/popover.PopoverModule.forRoot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。