本文整理汇总了TypeScript中angular2/src/core/dom/dom_adapter.DOM.querySelectorAll方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.querySelectorAll方法的具体用法?TypeScript DOM.querySelectorAll怎么用?TypeScript DOM.querySelectorAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/core/dom/dom_adapter.DOM
的用法示例。
在下文中一共展示了DOM.querySelectorAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
.then((fixture) => {
fixture.debugElement.componentInstance.booleanCondition = false;
fixture.detectChanges();
expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
fixture.debugElement.componentInstance.booleanCondition = true;
fixture.detectChanges();
expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello');
fixture.debugElement.componentInstance.nestedBooleanCondition = false;
fixture.detectChanges();
expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
fixture.debugElement.componentInstance.nestedBooleanCondition = true;
fixture.detectChanges();
expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello');
fixture.debugElement.componentInstance.booleanCondition = false;
fixture.detectChanges();
expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();
});
示例2: expect
.then((rootTC) => {
let homeDOMEl = rootTC.debugElement.componentViewChildren[0].nativeElement;
expect(DOM.querySelectorAll(homeDOMEl, 'h1')[0].textContent).toEqual('Howdy!');
async.done();
});
示例3: expect
.then((rootTC) => {
rootTC.detectChanges();
expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(rootTC.debugElement.nativeElement).toHaveText('hello');
async.done();
});
示例4: function
.then((rootTC) => {
rootTC.detectChanges();
let aboutInstance = rootTC.debugElement.componentViewChildren[0].componentInstance;
let aboutDOMEl = rootTC.debugElement.componentViewChildren[0].nativeElement;
let nameListLen = function () {
return aboutInstance.list.names.length;
};
expect(aboutInstance.list).toEqual(jasmine.any(NameList));
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');
});
示例5: function
.then((rootTC) => {
rootTC.detectChanges();
let todoInstance = rootTC.debugElement.componentViewChildren[0].componentInstance;
let aboutDOMEl = rootTC.debugElement.componentViewChildren[0].nativeElement;
var todosListLen = function () {
return todoInstance.todoService.get().length;
};
expect(todosListLen()).toEqual(2);
expect(DOM.querySelectorAll(aboutDOMEl, 'li').length).toEqual(todosListLen());
todoInstance.add({value: 'Test'});
rootTC.detectChanges();
expect(todosListLen()).toEqual(3);
expect(DOM.querySelectorAll(aboutDOMEl, 'li').length).toEqual(todosListLen());
expect(DOM.querySelectorAll(aboutDOMEl, 'li')[2].textContent).toContain('Test');
async.done();
});
示例6: function
.then((rootTC) => {
rootTC.detectChanges();
var offersComponentInstance = rootTC.componentViewChildren[0].componentInstance;
var componentDOMEl = rootTC.componentViewChildren[0].nativeElement;
var listLen = function () {
return offersComponentInstance.offers.length;
}
expect(offersComponentInstance.offers).toEqual(jasmine.any(HotelbookingServiceImpl.getOffers()));
expect(listLen()).toEqual(2);
expect(DOM.querySelectorAll(componentDOMEl, 'li').length).toEqual(listLen());
//offersComponentInstance.addName({value: 'Minko'});
HotelbookingServiceImpl.addOffer(new Offer('93475', 'Hotel Test', 98.98));
rootTC.detectChanges();
expect(listLen()).toEqual(3);
expect(DOM.querySelectorAll(componentDOMEl, 'li').length).toEqual(listLen());
expect(DOM.querySelectorAll(componentDOMEl, 'li')[4].textContent).toEqual('Hotel Test');
async.done();
});