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


TypeScript DOM.getText方法代码示例

本文整理汇总了TypeScript中angular2/src/dom/dom_adapter.DOM.getText方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.getText方法的具体用法?TypeScript DOM.getText怎么用?TypeScript DOM.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/src/dom/dom_adapter.DOM的用法示例。


在下文中一共展示了DOM.getText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: expect

             .then((view) => {
               view.context.booleanCondition = false;
               view.detectChanges();
               expect(DOM.querySelectorAll(view.rootNodes[0], 'copy-me').length).toEqual(0);
               expect(DOM.getText(view.rootNodes[0])).toEqual('');

               view.context.booleanCondition = true;
               view.detectChanges();
               expect(DOM.querySelectorAll(view.rootNodes[0], 'copy-me').length).toEqual(1);
               expect(DOM.getText(view.rootNodes[0])).toEqual('hello');

               view.context.nestedBooleanCondition = false;
               view.detectChanges();
               expect(DOM.querySelectorAll(view.rootNodes[0], 'copy-me').length).toEqual(0);
               expect(DOM.getText(view.rootNodes[0])).toEqual('');

               view.context.nestedBooleanCondition = true;
               view.detectChanges();
               expect(DOM.querySelectorAll(view.rootNodes[0], 'copy-me').length).toEqual(1);
               expect(DOM.getText(view.rootNodes[0])).toEqual('hello');

               view.context.booleanCondition = false;
               view.detectChanges();
               expect(DOM.querySelectorAll(view.rootNodes[0], 'copy-me').length).toEqual(0);
               expect(DOM.getText(view.rootNodes[0])).toEqual('');

               async.done();
             });
开发者ID:AsherBarak,项目名称:angular,代码行数:28,代码来源:ng_if_spec.ts

示例2: it

 it('should return the same style given the same component', () => {
   var styleElement = el('<style>.foo {} :host {}</style>');
   strategy.processStyleElement('someComponent', 'http://base', styleElement);
   var styleElement2 = el('<style>.foo {} :host {}</style>');
   strategy.processStyleElement('someComponent', 'http://base', styleElement2);
   expect(DOM.getText(styleElement)).toEqual(DOM.getText(styleElement2));
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:7,代码来源:emulated_scoped_shadow_dom_strategy_spec.ts

示例3: expect

               .then((view) => {
                 view.context.when1 = 'a';
                 view.context.when2 = 'b';
                 view.context.switchValue = 'a';
                 view.detectChanges();
                 expect(DOM.getText(view.rootNodes[0])).toEqual('when 1;');

                 view.context.switchValue = 'b';
                 view.detectChanges();
                 expect(DOM.getText(view.rootNodes[0])).toEqual('when 2;');

                 view.context.switchValue = 'c';
                 view.detectChanges();
                 expect(DOM.getText(view.rootNodes[0])).toEqual('when default;');

                 view.context.when1 = 'c';
                 view.detectChanges();
                 expect(DOM.getText(view.rootNodes[0])).toEqual('when 1;');

                 view.context.when1 = 'd';
                 view.detectChanges();
                 expect(DOM.getText(view.rootNodes[0])).toEqual('when default;');

                 async.done();
               });
开发者ID:Salim-K,项目名称:angular,代码行数:25,代码来源:ng_switch_spec.ts

示例4: expect

 tb.createView(TestComponent, {html: template}).then((view) => {
   view.context.items = [['a', 'b'], ['c']];
   view.detectChanges();
   expect(DOM.getText(view.nodes[0])).toEqual('a-2;b-2;c-1;');
   view.context.items = [['e'], ['f', 'g']];
   view.detectChanges();
   expect(DOM.getText(view.nodes[0])).toEqual('e-1;f-2;g-2;');
   async.done();
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:9,代码来源:for_spec.ts

示例5: expect

             .then((view) => {
               view.context.items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
               view.detectChanges();
               expect(DOM.getText(view.rootNodes[0])).toEqual('0123456789');

               view.context.items = [1, 2, 6, 7, 4, 3, 5, 8, 9, 0];
               view.detectChanges();
               expect(DOM.getText(view.rootNodes[0])).toEqual('0123456789');
               async.done();
             });
开发者ID:B-Thapa,项目名称:angular,代码行数:10,代码来源:ng_for_spec.ts

示例6: expect

 tb.createView(TestComponent, {html: html}).then((view) => {
   view.detectChanges();
   expect(DOM.querySelectorAll(view.nodes[0], 'copy-me').length).toEqual(1);
   expect(DOM.getText(view.nodes[0])).toEqual('hello');
   view.context.numberCondition = 2;
   view.detectChanges();
   expect(DOM.querySelectorAll(view.nodes[0], 'copy-me').length).toEqual(1);
   expect(DOM.getText(view.nodes[0])).toEqual('hello');
   async.done();
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:10,代码来源:if_spec.ts

示例7: expect

 tb.createView(TestComponent, {html: template}).then((view) => {
   view.detectChanges();
   expect(DOM.getText(view.nodes[0])).toEqual('when default1;when default2;');
   view.context.switchValue = 'a';
   view.detectChanges();
   expect(DOM.getText(view.nodes[0])).toEqual('when a1;when a2;');
   view.context.switchValue = 'b';
   view.detectChanges();
   expect(DOM.getText(view.nodes[0])).toEqual('when b1;when b2;');
   async.done();
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:11,代码来源:switch_spec.ts


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