当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript By.css方法代码示例

本文整理汇总了TypeScript中angular2/platform/common_dom.By.css方法的典型用法代码示例。如果您正苦于以下问题:TypeScript By.css方法的具体用法?TypeScript By.css怎么用?TypeScript By.css使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/platform/common_dom.By的用法示例。


在下文中一共展示了By.css方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: expect

 tcb.createAsync(TestComponent).then((testComponent) => {
   testComponent.detectChanges();
   testComponent.debugElement.query(By.css('a.detail-view-self'))
       .triggerEventHandler('click', null);
   expect(router.spy('navigateByInstruction')).toHaveBeenCalledWith(dummyInstruction);
   async.done();
 });
开发者ID:LordBinary,项目名称:angular,代码行数:7,代码来源:router_link_spec.ts

示例2: expect

 .then((testComponent) => {
   testComponent.detectChanges();
   testComponent.debugElement.query(By.css('a.detail-view-blank'))
       .triggerEventHandler('click', null);
   expect(router.spy('navigateByInstruction')).not.toHaveBeenCalled();
   async.done();
 });
开发者ID:ChinnasamyM,项目名称:angular,代码行数:7,代码来源:router_link_spec.ts

示例3: getChildrenBySelector

  /**
   * Gets a child DebugElement by css selector.
   *
   * The child of DebugElement are other elements that are "known" to
   * Angular.
   */
  static getChildrenBySelector(parent: DebugElement, selector: string): DebugElement[] {
    let results = [];

    parent.queryAll(By.css(selector)).forEach((el) => results.push(el));
    parent.children.forEach((de) => {
      TestHelper.getChildrenBySelector(de, selector).forEach((el) => results.push(el));
    });

    return results;
  }
开发者ID:Gitjerryzhong,项目名称:angular2,代码行数:16,代码来源:helper.ts

示例4: it

    it('can follow', () => {
      const cmp:FollowBtn = cmpDebugElement.componentInstance;
      cmp.isFollowedByMe = false;
      ctx.fixture.detectChanges();

      const followBtn = cmpDebugElement.query(By.css('.follow-btn')).nativeElement;
      expect(followBtn).toHaveText('Follow');

      followBtn.click();
      expect(cmp.isFollowedByMe).toBeTruthy();
      expect(relationshipService.follow).toHaveBeenCalledWith('1');
    });
开发者ID:windwang,项目名称:angular2-app,代码行数:12,代码来源:FollowBtn.spec.ts

示例5: spyOn

 return tcb.createAsync(TestComponent).then((fixture) => {
     fixture.detectChanges();
     spyOn(fixture.componentInstance, "fileUploaded");
     let el = fixture.debugElement.query(By.css('div#child'));
     el.triggerEventHandler('drop', {
         preventDefault(){
         },
         dataTransfer: {
             files: [1, 2, 3],
             items: [1, 2, 3]
         }
     });
     window.setTimeout(()=> {
         expect(fixture.componentInstance.fileUploaded).toHaveBeenCalledWith([1, 2, 3]);
     }, 300);
 });
开发者ID:anikets43,项目名称:fileDroppa,代码行数:16,代码来源:fileDroppa.spec.ts

示例6: it

  it('can be shown', () => {
    ctx.fixture.detectChanges();

    expect(cmpDebugElement).toBeTruthy();

    const cmp:UserList = cmpDebugElement.componentInstance;
    expect(cmp.users.length).toEqual(2);

    expect(DOM.querySelectorAll(cmpDebugElement.nativeElement, '.users>li').length).toEqual(2);

    const gravatarDebugElement = cmpDebugElement.query(By.directive(Gravatar));
    expect(gravatarDebugElement).toBeTruthy();
    expect(gravatarDebugElement.componentInstance.alt).toEqual('test1');
    expect(gravatarDebugElement.componentInstance.email).toEqual('test1@test.com');

    const userLink:HTMLElement = cmpDebugElement.query(By.css('.users>li>a')).nativeElement;
    expect(userLink.innerText).toEqual('test1');
    expect(userLink.getAttribute('href')).toEqual('/users/1');
  });
开发者ID:gtostock,项目名称:angular2-app,代码行数:19,代码来源:UserList.spec.ts

示例7: it

    it('can be shown', () => {
      expect(cmpDebugElement).toBeTruthy();

      const signupLink = cmpDebugElement.query(By.css('a')).nativeElement;
      expect(signupLink.getAttribute('href')).toEqual('/signup');
    });
开发者ID:windwang,项目名称:angular2-app,代码行数:6,代码来源:TopPage.spec.ts

示例8: getLinkElement

function getLinkElement(rtc: ComponentFixture, linkIndex: number = 0) {
  return rtc.debugElement.queryAll(By.css('a'))[linkIndex].nativeElement;
}
开发者ID:1186792881,项目名称:angular,代码行数:3,代码来源:aux_route_spec_impl.ts


注:本文中的angular2/platform/common_dom.By.css方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。