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


TypeScript By.directive方法代碼示例

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


在下文中一共展示了By.directive方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should set the title to the navbar', () => {
   const component = fixture.debugElement.query(By.directive(NavbarComponent)).componentInstance;
   expect(component.title).toEqual(app.title);
 });
開發者ID:Hagendorn,項目名稱:billing-ng2,代碼行數:4,代碼來源:app.component.spec.ts

示例2: getEmbeddedPlunkerComponent

 function getEmbeddedPlunkerComponent() {
   const compDe = liveExampleDe.query(By.directive(EmbeddedPlunkerComponent));
   return compDe && compDe.componentInstance as EmbeddedPlunkerComponent;
 }
開發者ID:jiw0220,項目名稱:jigsaw,代碼行數:4,代碼來源:live-example.component.spec.ts

示例3: expect

 .then((fixture: ComponentFixture<any>) => {
   let query = fixture.debugElement.query(By.directive(SyncComponent));
   expect(query).toBeTruthy();
   expect(query.componentInstance).toBeTruthy();
 });
開發者ID:angular,項目名稱:periscope,代碼行數:5,代碼來源:sync.component.spec.ts

示例4: it

		it('has no mail header component', () => {
			let mailHeader = fixture.debugElement.query(By.directive(MailHeaderComponent));
			expect(!!mailHeader).toBeFalsy();
		});
開發者ID:ziacik,項目名稱:amelie-mail,代碼行數:4,代碼來源:app.component.spec.ts

示例5: it

 it('should render copyable directive', () => {
     const copyable = fixture.debugElement.query(By.directive(CopyableComponent));
     const copyableInstance = copyable.injector.get(CopyableComponent) as CopyableComponent;
     expect(copyableInstance.content).toEqual('a_value');
 });
開發者ID:andrask,項目名稱:CloudFlow,代碼行數:5,代碼來源:info-item.component.spec.ts

示例6: beforeEach

 beforeEach(() => {
   directive = fixture.debugElement
     .query(By.directive(DataTableColumnDirective))
     .injector.get(DataTableColumnDirective);
 });
開發者ID:anisharknair,項目名稱:ngx-datatable,代碼行數:5,代碼來源:column.directive.spec.ts

示例7: it

 it('should apply CSS class to component', () => {
   const compiled = fixture.debugElement.query(By.directive(LoadingComponent)).nativeElement;
   expect(compiled.className).toBe('loading');
 });
開發者ID:Hagendorn,項目名稱:billing-ng2,代碼行數:4,代碼來源:loading.component.spec.ts

示例8:

/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */

import {DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';

var debugElement: DebugElement;
class MyDirective {}

// #docregion by_all
debugElement.query(By.all());
// #enddocregion

// #docregion by_css
debugElement.query(By.css('[attribute]'));
// #enddocregion

// #docregion by_directive
debugElement.query(By.directive(MyDirective));
// #enddocregion
開發者ID:4vanger,項目名稱:angular,代碼行數:25,代碼來源:by.ts


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