本文整理匯總了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',
//.........這裏部分代碼省略.........