本文整理汇总了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);
})));
示例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');
});
示例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)');
});
示例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);
});
示例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');
});
示例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);
}));
示例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');
});
示例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);
});