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


TypeScript dom_adapter.DOM类代码示例

本文整理汇总了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();
             });
开发者ID:TedSander,项目名称:angular,代码行数:33,代码来源:ng_if_spec.ts

示例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);
 }
开发者ID:beta3000,项目名称:hola-angular2,代码行数:7,代码来源:anchor_based_app_root_url.ts

示例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');
 });
开发者ID:TedSander,项目名称:angular,代码行数:7,代码来源:dom_adapter_spec.ts

示例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();
             });
开发者ID:TedSander,项目名称:angular,代码行数:9,代码来源:non_bindable_spec.ts

示例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();
               });
开发者ID:hankduan,项目名称:angular,代码行数:13,代码来源:ng_if_spec.ts

示例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);
         }
       }));
开发者ID:TedSander,项目名称:angular,代码行数:15,代码来源:animation_builder_spec.ts

示例7: bindAction

 bindAction('#reset-btn', () => {
   this._getScrollDiv().scrollTop = 0;
   var existingMarker = this._locateFinishedMarker();
   if (isPresent(existingMarker)) {
     DOM.removeChild(document.body, existingMarker);
   }
 });
开发者ID:TedSander,项目名称:angular,代码行数:7,代码来源:app.ts


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