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


TypeScript DOM.querySelectorAll方法代码示例

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

示例2: expect

          .then((rootTC) => {
            let homeDOMEl = rootTC.debugElement.componentViewChildren[0].nativeElement;

            expect(DOM.querySelectorAll(homeDOMEl, 'h1')[0].textContent).toEqual('Howdy!');

            async.done();
          });
开发者ID:lakshmiaswath,项目名称:angular2-todo,代码行数:7,代码来源:home.component.spec.ts

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

示例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');
          });
开发者ID:Flea505,项目名称:angular2-seed-ng2-bootstrap,代码行数:21,代码来源:about_spec.ts

示例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();
          });
开发者ID:lakshmiaswath,项目名称:angular2-todo,代码行数:22,代码来源:todo.component.spec.ts

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


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