本文整理汇总了TypeScript中angular2/src/core/dom/dom_adapter.DOM类的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM类的具体用法?TypeScript DOM怎么用?TypeScript DOM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DOM类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: constructor
constructor() {
super("");
// compute the root url to pass to AppRootUrl
var a = DOM.createElement('a');
DOM.resolveAndSetHref(a, './', null);
this.value = DOM.getHref(a);
}
示例3: it
it('should be able to create text nodes and use them with the other APIs', () => {
var t = DOM.createTextNode('hello');
expect(DOM.isTextNode(t)).toBe(true);
var d = DOM.createElement('div');
DOM.appendChild(d, t);
expect(DOM.getInnerHTML(d)).toEqual('hello');
});
示例4: expect
.then((fixture) => {
fixture.detectChanges();
// We must use DOM.querySelector instead of fixture.query here
// since the elements inside are not compiled.
var span = DOM.querySelector(fixture.debugElement.nativeElement, '#child');
expect(DOM.hasClass(span, 'compiled')).toBeFalsy();
async.done();
});
示例5: expect
.then((rootTC) => {
rootTC.detectChanges();
DOM.addClass(DOM.querySelector(rootTC.debugElement.nativeElement, 'copy-me'),
"foo");
rootTC.debugElement.componentInstance.numberCondition = 2;
rootTC.detectChanges();
expect(DOM.hasClass(
DOM.querySelector(rootTC.debugElement.nativeElement, 'copy-me'), "foo"))
.toBe(true);
async.done();
});
示例6: it
it('should support duration and delay defined in CSS', inject([AnimationBuilder], (animate) => {
var animateCss = animate.css();
var element =
el(`<div style="${DOM.getAnimationPrefix()}transition: 0.5s ease 250ms;"></div>`);
var runner = animateCss.start(element);
runner.flush();
if (DOM.supportsAnimation()) {
expect(runner.computedDelay).toBe(250);
expect(runner.computedDuration).toBe(500);
} else {
expect(runner.computedDelay).toEqual(0);
expect(runner.computedDuration).toEqual(0);
}
}));
示例7: bindAction
bindAction('#reset-btn', () => {
this._getScrollDiv().scrollTop = 0;
var existingMarker = this._locateFinishedMarker();
if (isPresent(existingMarker)) {
DOM.removeChild(document.body, existingMarker);
}
});