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


TypeScript test.it函數代碼示例

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


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

示例1: describe

  describe('About component', () => {
    it('should work',
      inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
        tcb.overrideTemplate(TestComponent, '<div><about></about></div>')
          .createAsync(TestComponent)
          .then((rootTC) => {
            rootTC.detectChanges();

            var aboutInstance = rootTC.componentViewChildren[0].componentInstance;
            var aboutDOMEl = rootTC.componentViewChildren[0].nativeElement;
            var nameListLen = function () {
              return aboutInstance.list.names.length;
            }

            expect(aboutInstance.list).toEqual(jasmine.any(NamesList));
            expect(nameListLen()).toEqual(4);
            expect(DOM.querySelectorAll(aboutDOMEl, 'li').length).toEqual(nameListLen());

            aboutInstance.addName({value: 'Minko'});
            rootTC.detectChanges();

            expect(nameListLen()).toEqual(5);
            expect(DOM.querySelectorAll(aboutDOMEl, 'li').length).toEqual(nameListLen());

            expect(DOM.querySelectorAll(aboutDOMEl, 'li')[4].textContent).toEqual('Minko');

            async.done();
          });
      }));
  });
開發者ID:andreyjkee,項目名稱:lazy-loading-routes-angular2,代碼行數:30,代碼來源:about_spec.ts

示例2: describe

  describe('Home component', () => {
    it('should work',
      inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
        tcb.overrideTemplate(TestComponent, '<div><home></home></div>')
          .createAsync(TestComponent)
          .then((rootTC) => {
            var homeDOMEl = rootTC.componentViewChildren[0].nativeElement;

            expect(DOM.querySelectorAll(homeDOMEl, 'h1')[0].textContent).toEqual('Howdy!');

            async.done();
          });
      }));
  });
開發者ID:andreyjkee,項目名稱:lazy-loading-routes-angular2,代碼行數:14,代碼來源:home_spec.ts

示例3: describe

  describe('Login[component]', () => {
    let builder: TestComponentBuilder;
    beforeEach(inject([TestComponentBuilder], (tcb) => { builder = tcb; }));

    it('should have login visible by default', inject([AsyncTestCompleter], (async) => {
      builder.createAsync(TestApp)
        .then((rootTC) => {
           var Login = rootTC.componentViewChildren[0].componentInstance;
           expect(Login.hideLogin).toEqual(false);
           async.done();
        })
        .catch((e) => {
          console.error(e);
          async.done();
        })
    }));

  });
開發者ID:mizsha,項目名稱:front,代碼行數:18,代碼來源:login_spec.ts


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