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


TypeScript TestComponentBuilder.overrideTemplate方法代碼示例

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


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

示例1: expect

           (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
             var template = `<template [ngTemplateOutlet]="null"></template>`;
             tcb.overrideTemplate(TestComponent, template)
                 .createAsync(TestComponent)
                 .then((fixture) => {

                   fixture.detectChanges();
                   expect(fixture.nativeElement).toHaveText('');

                   async.done();
                 });
           }));
開發者ID:lanting2009,項目名稱:angular,代碼行數:12,代碼來源:ng_template_outlet_spec.ts

示例2: inject

 inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
     tcb.overrideTemplate(TestCmp, `
         <ul>
             <li *ngFor="let item of collection | paginate: config" class="list-item">{{ item }}</li>
         </ul>
         <pagination-controls autoHide="false"></pagination-controls>`)
         .createAsync(TestCmp)
         .then((fixture: ComponentFixture<TestCmp>) => {
             fixture.detectChanges();
             expect(fixture.componentInstance.directionLinks).toBe(false);
         });
 }));
開發者ID:Muthukumaruma,項目名稱:ng2-pagination,代碼行數:12,代碼來源:pagination-controls-cmp.spec.ts

示例3: it

 it('should define default values for value and bufferValue attributes', (done: () => void) => {
   builder
     .overrideTemplate(TestApp, '<md-progress-bar></md-progress-bar>')
     .createAsync(TestApp)
     .then((fixture) => {
       fixture.detectChanges();
       let progressElement = fixture.debugElement.query(By.css('md-progress-bar'));
       expect(progressElement.componentInstance.value).toBe(0);
       expect(progressElement.componentInstance.bufferValue).toBe(0);
       done();
     });
 });
開發者ID:CodeStrider35,項目名稱:material2,代碼行數:12,代碼來源:progress-bar.spec.ts

示例4: it

		it('should detect and apply changes to model', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
			var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="opts"></ig-grid></div>';
			return tcb.overrideTemplate(TestComponent, template)
				.createAsync(TestComponent)
				.then((fixture) => {
					fixture.detectChanges();
					$(fixture.debugElement.nativeElement).find("#grid1 tr[data-id='2'] td[aria-describedby='grid1_Name']").click();
					$(fixture.debugElement.nativeElement).find("#grid1").igGridUpdating("setCellValue", 2, "Name", "Mary Jackson");
					$(fixture.debugElement.nativeElement).find("#grid1_container #grid1_updating_done").click();
					expect(fixture.debugElement.componentInstance.data[1].Name)
					.toBe("Mary Jackson");
				});
		}));
開發者ID:wsw2008new,項目名稱:igniteui-angular2,代碼行數:13,代碼來源:grid.spec.ts

示例5: Promise

 return new Promise((resolve, reject) => {
     tcb.overrideTemplate(TestComponent, template)
         .createAsync(TestComponent)
         .then((fixture) => {
             fixture.detectChanges();
             fixture.componentInstance.data = "<span>Test Update</span>";
             setTimeout(function () {
                 fixture.detectChanges();
                 expect($("#htmlEditor").igHtmlEditor("getContent", "html")).toBe("<span>Test Update</span>");
                 resolve();
             }, 10);
         });
 });
開發者ID:wsw2008new,項目名稱:igniteui-angular2,代碼行數:13,代碼來源:htmleditor.spec.ts

示例6: it

  it('should set the correct list height in fixed mode', async(() => {
    var template = `
      <md-grid-list cols="1" rowHeight="100px">
        <md-grid-tile></md-grid-tile>
        <md-grid-tile></md-grid-tile>
      </md-grid-list>`;

    builder.overrideTemplate(TestGridList, template).createAsync(TestGridList).then(fixture => {
      fixture.detectChanges();
      let list = fixture.debugElement.query(By.directive(MdGridList));
      expect(getProp(list, 'height')).toBe('201px');
    });
  }));
開發者ID:2947721120,項目名稱:material2,代碼行數:13,代碼來源:grid-list.spec.ts

示例7: it

 it('should throw error if tile colspan is wider than total cols', () => {
   var template = `
     <md-grid-list cols="4">
       <md-grid-tile colspan="5"></md-grid-tile>
     </md-grid-list>
   `;
   return builder.overrideTemplate(TestGridList, template)
       .createAsync(TestGridList).then((fixture: ComponentFixture<TestGridList>) => {
         expect(() => {
           fixture.detectChanges();
         }).toThrowError(/tile with colspan 5 is wider than grid/);
       });
 });
開發者ID:C2Cmall,項目名稱:material2,代碼行數:13,代碼來源:grid-list.spec.ts

示例8: async

   async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
      var template = '<ig-tab-bar></ig-tab-bar>';
        return tcb.overrideTemplate(TestComponentDI, template)
        .createAsync(TestComponentDI)
        .then((fixture) => {                  
            expect(fixture.componentInstance.viewChild).toBeDefined();
            expect(fixture.componentInstance.viewChild).toBeAnInstanceOf(Infragistics.TabBar);
            //expect(fixture.componentInstance.viewChild.state).toBeAnInstanceOf(Infragistics.NavigationService);
        }).catch (reason => {
            console.log(reason);
            return Promise.reject(reason);
        });
 })));
開發者ID:QuinntyneBrown,項目名稱:zero-blocks,代碼行數:13,代碼來源:tab.spec.ts

示例9: Promise

 return new Promise((resolve, reject) => {
     tcb.overrideTemplate(TestComponent, template)
         .createAsync(TestComponent)
         .then((fixture) => {
             fixture.detectChanges();
             fixture.componentInstance.data[0].Name = "Test";
             setTimeout(() => {
                 fixture.detectChanges();
                 expect($($("#tree1").igTree("nodeByIndex", 0)).children("a").text())
                     .toBe("Test");
                     resolve();
             }, 10);
         });
 });
開發者ID:wsw2008new,項目名稱:igniteui-angular2,代碼行數:14,代碼來源:igtree.spec.ts


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