本文整理汇总了TypeScript中ngx-bootstrap/alert.AlertModule类的典型用法代码示例。如果您正苦于以下问题:TypeScript AlertModule类的具体用法?TypeScript AlertModule怎么用?TypeScript AlertModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AlertModule类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('GrafanaComponent', () => {
let component: GrafanaComponent;
let fixture: ComponentFixture<GrafanaComponent>;
configureTestBed({
declarations: [GrafanaComponent, InfoPanelComponent, LoadingPanelComponent],
imports: [AlertModule.forRoot(), HttpClientTestingModule, RouterTestingModule],
providers: [CephReleaseNamePipe, SettingsService, SummaryService, i18nProviders]
});
beforeEach(() => {
fixture = TestBed.createComponent(GrafanaComponent);
component = fixture.componentInstance;
component.grafanaPath = 'somePath';
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should have found out that grafana does not exist', () => {
fixture.detectChanges();
expect(component.grafanaExist).toBe(false);
expect(component.baseUrl).toBe(undefined);
expect(component.loading).toBe(true);
expect(component.url).toBe(undefined);
expect(component.grafanaSrc).toEqual(undefined);
});
describe('with grafana initialized', () => {
beforeEach(() => {
TestBed.get(SettingsService).settings = { 'api/grafana/url': 'http:localhost:3000' };
fixture.detectChanges();
});
it('should have found out that grafana exists', () => {
expect(component.grafanaExist).toBe(true);
expect(component.baseUrl).toBe('http:localhost:3000/d/');
expect(component.loading).toBe(false);
component.uid = 'uid';
component.getFrame();
expect(component.url).toBe('http:localhost:3000/d/uid/somePath&refresh=2s&kiosk');
expect(component.grafanaSrc).toEqual({
changingThisBreaksApplicationSecurity: 'http:localhost:3000/d/uid/somePath&refresh=2s&kiosk'
});
});
it('should have Dashboard', () => {
TestBed.get(SettingsService).validateGrafanaDashboardUrl = { uid: 200 };
expect(component.dashboardExist).toBe(true);
});
});
});
示例2: describe
describe('ErrorPanelComponent', () => {
let component: ErrorPanelComponent;
let fixture: ComponentFixture<ErrorPanelComponent>;
configureTestBed({
declarations: [ErrorPanelComponent],
imports: [AlertModule.forRoot()]
});
beforeEach(() => {
fixture = TestBed.createComponent(ErrorPanelComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
示例3: describe
describe('GrafanaComponent', () => {
let component: GrafanaComponent;
let fixture: ComponentFixture<GrafanaComponent>;
configureTestBed({
declarations: [GrafanaComponent, InfoPanelComponent, LoadingPanelComponent],
imports: [AlertModule.forRoot(), HttpClientTestingModule, RouterTestingModule],
providers: [CephReleaseNamePipe, SettingsService, SummaryService]
});
beforeEach(() => {
fixture = TestBed.createComponent(GrafanaComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
示例4: describe
describe('RbdListComponent', () => {
let fixture: ComponentFixture<RbdListComponent>;
let component: RbdListComponent;
let summaryService: SummaryService;
let rbdService: RbdService;
const refresh = (data) => {
summaryService['summaryDataSource'].next(data);
};
configureTestBed({
imports: [
SharedModule,
BsDropdownModule.forRoot(),
TabsModule.forRoot(),
ModalModule.forRoot(),
TooltipModule.forRoot(),
ToastModule.forRoot(),
AlertModule.forRoot(),
RouterTestingModule,
HttpClientTestingModule
],
declarations: [
RbdListComponent,
RbdDetailsComponent,
RbdSnapshotListComponent,
RbdConfigurationListComponent
],
providers: [TaskListService, i18nProviders]
});
beforeEach(() => {
fixture = TestBed.createComponent(RbdListComponent);
component = fixture.componentInstance;
summaryService = TestBed.get(SummaryService);
rbdService = TestBed.get(RbdService);
// this is needed because summaryService isn't being reset after each test.
summaryService['summaryDataSource'] = new BehaviorSubject(null);
summaryService['summaryData$'] = summaryService['summaryDataSource'].asObservable();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe('after ngOnInit', () => {
beforeEach(() => {
fixture.detectChanges();
spyOn(rbdService, 'list').and.callThrough();
});
it('should load images on init', () => {
refresh({});
expect(rbdService.list).toHaveBeenCalled();
});
it('should not load images on init because no data', () => {
refresh(undefined);
expect(rbdService.list).not.toHaveBeenCalled();
});
it('should call error function on init when summary service fails', () => {
spyOn(component.table, 'reset');
summaryService['summaryDataSource'].error(undefined);
expect(component.table.reset).toHaveBeenCalled();
expect(component.viewCacheStatusList).toEqual([{ status: ViewCacheStatus.ValueException }]);
});
});
describe('handling of executing tasks', () => {
let images: RbdModel[];
const addImage = (name) => {
const model = new RbdModel();
model.id = '-1';
model.name = name;
model.pool_name = 'rbd';
images.push(model);
};
const addTask = (name: string, image_name: string) => {
const task = new ExecutingTask();
task.name = name;
switch (task.name) {
case 'rbd/copy':
task.metadata = {
dest_pool_name: 'rbd',
dest_image_name: 'd'
};
break;
case 'rbd/clone':
task.metadata = {
child_pool_name: 'rbd',
child_image_name: 'd'
};
break;
default:
task.metadata = {
pool_name: 'rbd',
//.........这里部分代码省略.........