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


TypeScript testing.it函數代碼示例

本文整理匯總了TypeScript中@angular/core/testing.it函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript it函數的具體用法?TypeScript it怎麽用?TypeScript it使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: describe

        describe('should emit Highcharts series event', () => {
            it('"afterAnimate"', (done) => {
                create(`
                <chart [options]="options">
                    <series (afterAnimate)="onEvent()"></series>
                </chart>
            `).then(fixture => {
                    fixture.componentInstance.onEvent = () => done();
                    fixture.componentInstance.options = ['options'];
                    fixture.detectChanges();
                    ChartEventEmitter.emitSeriesEvent('afterAnimate');
                });
            });

            it('"checkboxClick"', (done) => {
                create(`
                <chart [options]="options">
                    <series (checkboxClick)="onEvent()"></series>
                </chart>
            `).then(fixture => {
                    fixture.componentInstance.onEvent = () => done();
                    fixture.componentInstance.options = ['options'];
                    fixture.detectChanges();
                    ChartEventEmitter.emitSeriesEvent('checkboxClick');
                });
            });

            it('"click"', (done) => {
                create(`
                <chart [options]="options">
                    <series (click)="onEvent()"></series>
                </chart>
            `).then(fixture => {
                    fixture.componentInstance.onEvent = () => done();
                    fixture.componentInstance.options = ['options'];
                    fixture.detectChanges();
                    ChartEventEmitter.emitSeriesEvent('click');
                });
            });

            it('"hide"', (done) => {
                create(`
                <chart [options]="options">
                    <series (hide)="onEvent()"></series>
                </chart>
            `).then(fixture => {
                    fixture.componentInstance.onEvent = () => done();
                    fixture.componentInstance.options = ['options'];
                    fixture.detectChanges();
                    ChartEventEmitter.emitSeriesEvent('hide');
                });
            });

            it('"legendItemClick"', (done) => {
                create(`
                <chart [options]="options">
                    <series (legendItemClick)="onEvent()"></series>
                </chart>
            `).then(fixture => {
                    fixture.componentInstance.onEvent = () => done();
                    fixture.componentInstance.options = ['options'];
                    fixture.detectChanges();
                    ChartEventEmitter.emitSeriesEvent('legendItemClick');
                });
            });

            it('"mouseOut"', (done) => {
                create(`
                <chart [options]="options">
                    <series (mouseOut)="onEvent()"></series>
                </chart>
            `).then(fixture => {
                    fixture.componentInstance.onEvent = () => done();
                    fixture.componentInstance.options = ['options'];
                    fixture.detectChanges();
                    ChartEventEmitter.emitSeriesEvent('mouseOut');
                });
            });

            it('"mouseOver"', (done) => {
                create(`
                <chart [options]="options">
                    <series (mouseOver)="onEvent()"></series>
                </chart>
            `).then(fixture => {
                    fixture.componentInstance.onEvent = () => done();
                    fixture.componentInstance.options = ['options'];
                    fixture.detectChanges();
                    ChartEventEmitter.emitSeriesEvent('mouseOver');
                });
            });

            it('"show"', (done) => {
                create(`
                <chart [options]="options">
                    <series (show)="onEvent()"></series>
                </chart>
            `).then(fixture => {
                    fixture.componentInstance.onEvent = () => done();
                    fixture.componentInstance.options = ['options'];
//.........這裏部分代碼省略.........
開發者ID:ywmail,項目名稱:angular2-highcharts,代碼行數:101,代碼來源:ChartComponent.spec.ts

示例2: describe

describe('Service: TestService', () => {
  let mockbackend, service;
  /*beforeEachProviders(() => [
    Busses,
    MockBackend,
    BaseRequestOptions,
    provide(Http, {
      useFactory: (backend, options) => new Http(backend, options), 
      deps: [MockBackend, BaseRequestOptions]})
  ]);

  beforeEachProviders(() => {
    return [
      HTTP_PROVIDERS,
      provide(XHRBackend, {useClass: MockBackend}),
      Busses
    ];
  });
*/
let response =   {busses:  [
        {
        id: 1,
        numberPlate: "KL-AB345",
        color: "green",
        picture: "http://www.tm4.com/wp-content/uploads/2014/08/Foton-bus-12-m-e1407525133477.png"
         },
        {
        id: 2,
        numberPlate: "KL-CD678",
        color: "red",
        picture: "http://littlebabybum.com/wp-content/uploads/2015/01/wheels-on-the-bus-red.png"
      }]};

  beforeEachProviders(() => [
    Busses,
    BaseRequestOptions,
    MockBackend,
    provide(Http, {
      useFactory: (backend: MockBackend, defaultOptions: BaseRequestOptions) => {
        return new Http(backend, defaultOptions);
      },
      deps: [MockBackend, BaseRequestOptions]
    })
  ]);
  
  /*beforeEach(inject([XHRBackend, Busses], (_mockbackend, _service) => {
    mockbackend = _mockbackend;
    service = _service;
  }))*/

  console.log("create connection...");
  beforeEach(inject([MockBackend], (backend: MockBackend) => {
    const baseResponse = new Response(new ResponseOptions({ body: response }));
    backend.connections.subscribe((c: MockConnection) => c.mockRespond(baseResponse));
  }));
  
  //specs
  it('should request busses from server',  inject([Busses], (service: Busses) => {
    
    /*mockbackend.connections.subscribe(connection => {
      connection.mockRespond(new Response(new ResponseOptions({body:response})));
    });*/ 
    
    console.log("start request...");
    service.requestBusses("");
    console.log("finished test spec request");
    console.log(service.getBusses());
    expect(service.getBusses()).not.toEqual([]);
    
    }));
  });
開發者ID:GSE-Project,項目名稱:SS2016-group3,代碼行數:71,代碼來源:bussesSpec.ts

示例3: describe

describe('Component: ChessBoard', () => {
  it('should create an instance', () => {
    let component = new ChessBoardComponent();
    expect(component).toBeTruthy();
  });
});
開發者ID:Tony-Luo,項目名稱:Ng-chess,代碼行數:6,代碼來源:chess-board.component.spec.ts

示例4: describe

describe('App: Pcards', () => {
  it('should create the app',
      inject([AppComponent], (app: AppComponent) => {
    expect(app).toBeTruthy();
  }));
});
開發者ID:westonpace,項目名稱:pcards,代碼行數:6,代碼來源:app.component.spec.ts

示例5: describe

describe('Smoke test', () => {
  it('should run a passing test', () => {
    expect(true).toEqual(true, 'should pass');
  });
});
開發者ID:samk-ayyagari,項目名稱:angular-2,代碼行數:5,代碼來源:app.component.spec.ts

示例6: describe

describe('Component: Logout', () => {
  it('should create an instance', () => {
    //let component = new LogoutComponent();
    //expect(component).toBeTruthy();
  });
});
開發者ID:yboujallab,項目名稱:angular2-portal,代碼行數:6,代碼來源:logout.component.spec.ts

示例7: describe

describe('Component: Article', () => {
  it('should create an instance', () => {
    let component = new ArticleComponent();
    expect(component).toBeTruthy();
  });
});
開發者ID:Chris99252,項目名稱:Angular2Demo1,代碼行數:6,代碼來源:article.component.spec.ts

示例8: describe

describe('List Group:', () => {
    
    var listGroup: ListGroup<TestOption> = null;
    
    beforeEach(() => {
        listGroup = new ListGroup<TestOption>();
        listGroup.getLabel = option => option.name;
    });
    
    it('by default, uses JSON.stringify', () => {
        let option = new TestOption('id', 'value');
        expect(listGroup.getId(option)).toEqual(JSON.stringify(option));
    });
    
    describe('selection:', () => {
        
        beforeEach(() => {
            listGroup.getId = option => option.id;
        });
        
        it('selects an option', (done) => {
            let option = new TestOption('id', 'value');
            
            listGroup.select(option)
            
            listGroup.selection.subscribe(selection => {
                expect(selection['id']).toEqual(option);
                done();
            });
        });
        
        it('selects multiple options', (done) => {
            let options = [
                new TestOption('id', 'value'),
                new TestOption('id2', 'value')
            ];
            
            options.forEach(option => listGroup.select(option));
            
            listGroup.selection.subscribe(selection => {
                options.forEach(option => expect(selection[option.id]).toEqual(option));
                done();
            });
        });
        
        it('deselects double selected options in multi-select', (done) => {
            let options = [
                new TestOption('id', 'value'),
                new TestOption('id2', 'value'),
                new TestOption('id2', 'value')
            ];
            
            options.forEach(option => listGroup.select(option));
            
            listGroup.selection.subscribe(selection => {
                expect(selection['id']).toEqual(options[0]);
                expect(selection['id2']).toBeUndefined();
                done();
            });
        });
        
        it('deselects double selected options in multi-select', (done) => {
            let options = [
                new TestOption('id', 'value'),
                new TestOption('id2', 'value'),
                new TestOption('id2', 'value')
            ];
            
            options.forEach(option => listGroup.select(option));
            
            listGroup.selection.subscribe(selection => {
                expect(selection['id']).toEqual(options[0]);
                expect(selection['id2']).toBeUndefined();
                done();
            });
        });
        
        it('selects single option', (done) => {
            listGroup.isMultiple = false;
            
            let options = [
                new TestOption('id', 'value'),
                new TestOption('id2', 'value')
            ];
            
            options.forEach(option => listGroup.select(option));
            
            listGroup.selection.subscribe(selection => {
                expect(selection['id']).toBeUndefined();
                expect(selection['id2']).toEqual(options[1]);
                done();
            });
        });
        
        it('deselects single option', (done) => {
            listGroup.isMultiple = false;
            
            let options = [
                new TestOption('id', 'value'),
                new TestOption('id', 'value')
//.........這裏部分代碼省略.........
開發者ID:Azure,項目名稱:azure-iot-library,代碼行數:101,代碼來源:list-group.spec.ts


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