本文整理汇总了TypeScript中@angular/core.DebugElement类的典型用法代码示例。如果您正苦于以下问题:TypeScript DebugElement类的具体用法?TypeScript DebugElement怎么用?TypeScript DebugElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DebugElement类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('PodcastsComponent', () => {
let comp: PodcastsComponent;
let fixture: ComponentFixture<PodcastsComponent>;
let el: DebugElement;
let store: Store<AppState>;
beforeEach(
async(() => {
TestBed.configureTestingModule({
imports: [
MatToolbarModule,
MatIconModule,
RouterTestingModule,
ToolbarModule,
/* NgRx */
StoreModule.forRoot({}),
StoreModule.forFeature('podcasts', fromPodcasts.reducer)
],
declarations: [PodcastsComponent]
}).compileComponents();
})
);
beforeEach(() => {
store = TestBed.get(Store);
spyOn(store, 'dispatch').and.callThrough();
spyOn(store, 'select').and.callThrough();
});
beforeEach(() => {
store.dispatch(new FindAllSuccess(podcasts));
fixture = TestBed.createComponent(PodcastsComponent);
comp = fixture.componentInstance;
el = fixture.debugElement;
fixture.detectChanges();
});
it('should be created', () => {
expect(comp).toBeTruthy();
});
it('should init with podcasts from resolver', () => {
/* Given */
/* When */
fixture.whenStable().then(() => {
/* Then */
const podcastsCards = el.queryAll(By.css('img'));
expect(podcastsCards.length).toEqual(8);
});
});
it('should open sidenav if click on burger button', () => {
/* Given */
const button = el.query(By.css('.toolbar__hamburger'));
/* When */
button.triggerEventHandler('click', null);
/* Then */
expect(store.dispatch).toHaveBeenCalledWith(new OpenSideNavAction());
});
});
开发者ID:davinkevin,项目名称:Podcast-Server,代码行数:61,代码来源:podcasts.component.spec.ts
示例2: describe
describe('DotAddContentletComponent', () => {
let component: DotAddContentletComponent;
let de: DebugElement;
let fixture: ComponentFixture<DotAddContentletComponent>;
let dotAddContentletWrapper: DebugElement;
let dotAddContentletWrapperComponent: DotContentletWrapperComponent;
let dotContentletEditorService: DotContentletEditorService;
beforeEach(async(() => {
DOTTestBed.configureTestingModule({
declarations: [DotAddContentletComponent, DotContentletWrapperComponent],
providers: [
DotContentletEditorService,
DotMenuService,
{
provide: LoginService,
useClass: LoginServiceMock
}
],
imports: [DotIframeDialogModule, BrowserAnimationsModule, RouterTestingModule]
}).compileComponents();
}));
beforeEach(() => {
fixture = DOTTestBed.createComponent(DotAddContentletComponent);
de = fixture.debugElement;
component = de.componentInstance;
dotContentletEditorService = de.injector.get(DotContentletEditorService);
spyOn(component.close, 'emit');
fixture.detectChanges();
dotAddContentletWrapper = de.query(By.css('dot-contentlet-wrapper'));
dotAddContentletWrapperComponent = dotAddContentletWrapper.componentInstance;
});
describe('default', () => {
it('should have dot-contentlet-wrapper', () => {
expect(dotAddContentletWrapper).toBeTruthy();
});
it('should emit close', () => {
dotAddContentletWrapper.triggerEventHandler('close', {});
expect(component.close.emit).toHaveBeenCalledTimes(1);
});
it('should have url in null', () => {
expect(dotAddContentletWrapperComponent.url).toEqual(null);
});
it('should set url', () => {
dotContentletEditorService.add({
header: 'Add some content',
data: {
container: '123',
baseTypes: 'content,form'
},
events: {
load: jasmine.createSpy('load'),
keyDown: jasmine.createSpy('keyDown')
}
});
fixture.detectChanges();
expect(dotAddContentletWrapperComponent.url).toEqual(
'/html/ng-contentlet-selector.jsp?ng=true&container_id=123&add=content,form'
);
expect(dotAddContentletWrapperComponent.header).toEqual('Add some content');
});
});
});
开发者ID:dotCMS,项目名称:core-web,代码行数:74,代码来源:dot-add-contentlet.component.spec.ts
示例3: it
it('should be custom actions', () => {
expect(dl.queryAll(By.css('#action-edit')).length).toBe(1);
});
开发者ID:wexz,项目名称:delon,代码行数:3,代码来源:exception.spec.ts
示例4: beforeEach
beforeEach(() => {
fixture.detectChanges();
button = de.query(By.css('dot-icon-button'));
});
开发者ID:dotCMS,项目名称:core-web,代码行数:4,代码来源:dot-copy-button.component.spec.ts
示例5: it
it('should not show button', () => {
button = de.query(By.css('dot-icon-button'));
expect(button).toBeNull();
});
开发者ID:dotCMS,项目名称:core-web,代码行数:4,代码来源:dot-copy-button.component.spec.ts
示例6: it
it('should display value of 0 by default', () => {
fixture.detectChanges();
const headerElement = el.query(By.css('h1'));
expect(headerElement.nativeElement.textContent).toEqual('hello world zero (ZERO)');
});
开发者ID:loki2302,项目名称:html5-experiment,代码行数:6,代码来源:calculator.component.spec.ts
示例7: getEmbeddedPlunkerComponent
function getEmbeddedPlunkerComponent() {
const compDe = liveExampleDe.query(By.directive(EmbeddedPlunkerComponent));
return compDe && compDe.componentInstance as EmbeddedPlunkerComponent;
}
开发者ID:gautamkrishnar,项目名称:angular,代码行数:4,代码来源:live-example.component.spec.ts
示例8: getImg
function getImg() {
const img = liveExampleDe.query(By.css('img'));
return img && img.nativeElement as HTMLImageElement;
}
开发者ID:gautamkrishnar,项目名称:angular,代码行数:4,代码来源:live-example.component.spec.ts
示例9: it
it('should create an empty variable', () => {
fixture.detectChanges();
de.query(By.css('.action-header__primary-button')).triggerEventHandler('click', { stopPropagation: () => {} });
expect(comp.fieldVariables.length).toBe(4);
expect(comp.fieldVariablesBackup.length).toBe(4);
});
开发者ID:dotCMS,项目名称:core-web,代码行数:6,代码来源:dot-content-type-fields-variables.component.spec.ts
注:本文中的@angular/core.DebugElement类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论