本文整理汇总了TypeScript中glimmer-test-helpers.TestEnvironment类的典型用法代码示例。如果您正苦于以下问题:TypeScript TestEnvironment类的具体用法?TypeScript TestEnvironment怎么用?TypeScript TestEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestEnvironment类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
window['$BENCH'].render = function() {
let { env, context, template, TestDynamicScope } = this;
let frag = document.createDocumentFragment();
env.begin();
template.render(context, env, { appendTo: frag, dynamicScope: new TestDynamicScope(null) });
env.commit();
return frag;
};
开发者ID:GCheung55,项目名称:glimmer,代码行数:8,代码来源:bench-inline.ts
示例2: function
test("Morphs are escaped correctly", function() {
env.registerHelper('testing-unescaped', function(params) {
return params[0];
});
env.registerHelper('testing-escaped', function(params, hash) {
return params[0];
});
compilesTo('<div>{{{testing-unescaped "<span>hi</span>"}}}</div>', '<div><span>hi</span></div>');
compilesTo('<div>{{testing-escaped "<hi>"}}</div>', '<div><hi></div>');
});
开发者ID:Joelkang,项目名称:glimmer,代码行数:12,代码来源:initial-render-test.ts
示例3: rerender
function rerender(context: Object = {}, params: RerenderParams = { assertStable: false }) {
let snapshot;
if (params.assertStable) {
snapshot = generateSnapshot(root);
}
self.update(opaque(context));
env.begin();
result.rerender();
env.commit();
if (params.assertStable) {
equalSnapshots(generateSnapshot(root), snapshot);
}
}
开发者ID:byelipk,项目名称:glimmer,代码行数:13,代码来源:partial-test.ts
示例4: compile
QUnit.test('changing dynamic partial and changing references', assert => {
let template = compile(`{{partial name}}`);
env.registerPartial('weezy', `Ain't my birthday but I got my {{item}} on the cake.`);
env.registerPartial('birdman', `Respeck my {{noun}}. When my {{noun}} come up put some respeck on it.`);
render(template, { name: 'weezy', item: 'partial' });
equalTokens(root, `Ain't my birthday but I got my partial on the cake.`);
rerender({ name: 'birdman', noun: 'name' });
equalTokens(root, `Respeck my name. When my name come up put some respeck on it.`);
rerender({ name: 'birdman', noun: 'name' }, { assertStable: true });
equalTokens(root, `Respeck my name. When my name come up put some respeck on it.`);
});
开发者ID:byelipk,项目名称:glimmer,代码行数:13,代码来源:partial-test.ts
示例5: function
test("GH#13999 The compiler can handle components with undefined named arguments", function() {
env.registerHelper('say-hello', function() {
return 'hello';
});
compilesTo('<div>{{say-hello foo=undefined}}</div>', '<div>hello</div>');
});
开发者ID:Radascript,项目名称:glimmer,代码行数:7,代码来源:initial-render-test.ts
注:本文中的glimmer-test-helpers.TestEnvironment类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论