本文整理汇总了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();
});
示例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));
});
示例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();
});
示例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();
});
示例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();
});
示例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();
});
示例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();
});