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


TypeScript DebugElement.queryAll方法代码示例

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


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

示例1: it

    it('should remove messages after 4 seconds', fakeAsync(inject([AlertService], (service: AlertService) => {
        fixture.detectChanges();

        service.successStatus$.next({title: 'myTitle', text: 'myText', icon: '#icon'});

        tick();

        fixture.detectChanges();

        component['messages'].length.should.equal(1);

        component['messages'][0].should.deep.equal({title: 'myTitle', text: 'myText', icon: '#icon'});

        let allMessageElements = successElement.queryAll(By.css('.container'));
        allMessageElements.length.should.equal(1);

        let titleElement = allMessageElements[0].query(By.css('.notification-title'));
        titleElement.nativeElement.textContent.should.equal('myTitle');

        let textElement = allMessageElements[0].query(By.css('.notification-text'));
        textElement.nativeElement.innerHTML.should.equal('myText');

        tick(messageTimeout);

        fixture.detectChanges();

        component['messages'].length.should.equal(0);

        allMessageElements = successElement.queryAll(By.css('.container'));
        allMessageElements.length.should.equal(0);
    })));
开发者ID:marlonprudente,项目名称:composer,代码行数:31,代码来源:success.component.spec.ts

示例2: it

    it('should handle columns changing after initialization', () => {
      let component: GridDynamicTestComponent,
        fixture: ComponentFixture<GridDynamicTestComponent>,
        nativeElement: HTMLElement,
        element: DebugElement;

      TestBed.configureTestingModule({
        imports: [
          GridFixturesModule,
          SkyGridModule
        ]
      });

      fixture = TestBed.createComponent(GridDynamicTestComponent);
      nativeElement = fixture.nativeElement as HTMLElement;
      element = fixture.debugElement as DebugElement;
      component = fixture.componentInstance;

      fixture.detectChanges();

      expect(element.queryAll(By.css('th.sky-grid-heading')).length).toBe(2);
      expect(getColumnHeader('name', element).nativeElement.textContent.trim())
        .toBe('Name Initial');
      expect(getColumnHeader('email', element).nativeElement.textContent.trim())
        .toBe('Email Initial');

      component.changeColumns();
      fixture.detectChanges();

      expect(element.queryAll(By.css('th.sky-grid-heading')).length).toBe(2);
      expect(getColumnHeader('name', element).nativeElement.textContent.trim())
        .toBe('Name');
      expect(getColumnHeader('email', element).nativeElement.textContent.trim())
        .toBe('Email');
    });
开发者ID:Blackbaud-DanHamlin,项目名称:skyux2,代码行数:35,代码来源:grid.component.spec.ts

示例3: it

                it('should have archived item and message', () => {
                    const archivedItems = de.queryAll(By.css('.workflow__archive-label'));
                    expect(archivedItems.length).toBe(1);
                    expect(archivedItems[0].nativeElement.innerText).toBe(mockWorkflows[1].name);

                    const archivedMessage = de.queryAll(By.css('.workflow__archive-message'));
                    expect(archivedMessage.length).toBe(1);
                    expect(archivedMessage[0].nativeElement.innerText).toBe('(Archivado)');
                });
开发者ID:dotCMS,项目名称:core-web,代码行数:9,代码来源:dot-workflows-selector-field.component.spec.ts

示例4: it

 it('should load new data', () => {
   expect(element.queryAll(By.css('tr.sky-grid-row')).length).toBe(7);
   fixture.detectChanges();
   bs.next([
     { id: '1', column1: '1', column2: 'Large',
       column3: 2, column4: moment().add(15, 'minute') },
     { id: '2', column1: '22', column2: 'Small',
       column3: 3, column4: moment().add(60, 'minute') },
     { id: '3', column1: '33', column2: 'Medium',
       column3: 4, column4: moment().add(45, 'minute') }
   ]);
   fixture.detectChanges();
   expect(element.queryAll(By.css('tr.sky-grid-row')).length).toBe(3);
 });
开发者ID:Blackbaud-DanHamlin,项目名称:skyux2,代码行数:14,代码来源:list.component.spec.ts

示例5: ListViewsLoadAction

      fixture.whenStable().then(() => {
        fixture.detectChanges();

        dispatcher.next(
          new ListViewsLoadAction([new ListViewModel('myview', 'view label')])
        );
        fixture.detectChanges();

          // activate the default view
        dispatcher.next(new ListViewsSetActiveAction('myview'));
        fixture.detectChanges();

        dispatcher.next(new ListToolbarItemsLoadAction([
          new ListToolbarItemModel({
            id: 'newitem',
            location: 'center',
            view: 'myview',
            template: component.default
          })
        ]));
        fixture.detectChanges();

        let items = element.queryAll(By.css('.sky-toolbar-item'));
        expect(items[0].nativeElement).toHaveText('');
        expect(items[1].query(By.css('input'))).not.toBeNull();
        expect(items[2].query(By.css('span')).nativeElement).toHaveCssClass('sky-test-toolbar');
        expect(items[3].query(By.css('.sky-sort'))).not.toBeNull();
        expect(items[4].nativeElement).toHaveText('Custom Item');
        expect(items[5].nativeElement).toHaveText('Custom Item 2');

         dispatcher.next(new ListToolbarItemsLoadAction([
          new ListToolbarItemModel({
            id: 'newitem2',
            location: 'center',
            view: 'myview1',
            template: component.default
          })
        ]));
        fixture.detectChanges();

        items = element.queryAll(By.css('.sky-toolbar-item'));
        expect(items[0].nativeElement).toHaveText('');
        expect(items[1].query(By.css('input'))).not.toBeNull();
        expect(items[2].query(By.css('span')).nativeElement).toHaveCssClass('sky-test-toolbar');
        expect(items[3].query(By.css('.sky-sort'))).not.toBeNull();
        expect(items[4].nativeElement).toHaveText('Custom Item');
        expect(items[5].nativeElement).toHaveText('Custom Item 2');

      });
开发者ID:Blackbaud-DanHamlin,项目名称:skyux2,代码行数:49,代码来源:list-toolbar.component.spec.ts

示例6: it

  it('addSubEntry() and removeSubEntry()', fakeAsync(() => {
    entry.categoryId = 444;
    handleChanges();
    expect(de.queryAll(By.css('p')).length).toBe(4);

    comp.addSubEntry();
    handleChanges();
    expect(de.queryAll(By.css('p')).length).toBe(5);

    comp.removeSubEntry(entry.subEntries[0]);
    comp.removeSubEntry(entry.subEntries[0]);
    comp.removeSubEntry(entry.subEntries[0]);
    handleChanges();
    expect(de.queryAll(By.css('p')).length).toBe(2);
  }));
开发者ID:jogy,项目名称:jmoney,代码行数:15,代码来源:entry-detail.component.spec.ts

示例7: expect

 fixture.whenStable().then(() => {
     fixture.detectChanges();
     debug.query(By.css('.mat-select-trigger')).triggerEventHandler('click', null);
     fixture.detectChanges();
     let options: any = debug.queryAll(By.css('mat-option'));
     expect(options[0].nativeElement.innerText).not.toContain('DROPDOWN.MY_FILES_OPTION');
 });
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:7,代码来源:sites-dropdown.component.spec.ts

示例8: it

    it('should show error message for required form fields', () => {
        component.forgotPasswordForm.get('login').markAsDirty();
        fixture.detectChanges();

        const errorMessages = de.queryAll(By.css('.ui-messages-error'));
        expect(errorMessages.length).toBe(1);
    });
开发者ID:dotCMS,项目名称:core-web,代码行数:7,代码来源:forgot-password.component.spec.ts


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