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


TypeScript core.DebugElement類代碼示例

本文整理匯總了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;未經允許,請勿轉載。