本文整理汇总了TypeScript中@glimmer/test-helpers.TestEnvironment类的典型用法代码示例。如果您正苦于以下问题:TypeScript TestEnvironment类的具体用法?TypeScript TestEnvironment怎么用?TypeScript TestEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestEnvironment类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: render
function render(template: Template, self: any) {
let result: RenderResult;
env.begin();
let templateIterator = template.renderLayout({ env, self: new UpdatableReference(self), cursor: { element: root, nextSibling: null }, dynamicScope: new TestDynamicScope() });
let iteratorResult: IteratorResult<RenderResult>;
do {
iteratorResult = templateIterator.next() as IteratorResult<RenderResult>;
} while (!iteratorResult.done);
result = iteratorResult.value;
env.commit();
return result;
}
示例2: test
test("HTML tags re-rendered", assert => {
let template = compile("<h1>hello!</h1><div>content</div>");
let result = render(template, {});
let oldFirstChild = root.firstChild;
env.begin();
result.rerender();
env.commit();
assert.strictEqual(root.firstChild, oldFirstChild);
equalTokens(root, "<h1>hello!</h1><div>content</div>");
});
示例3: UpdatableReference
function render<T>(template: Template<T>, self: any) {
let result;
env.begin();
let templateIterator = template.render(new UpdatableReference(self), root, new TestDynamicScope());
do {
result = templateIterator.next();
} while (!result.done);
result = result.value;
env.commit();
return result;
}
示例4: UpdatableReference
function render<T>(template: Template<T>, context={}) {
self = new UpdatableReference(context);
env.begin();
let templateIterator = template.render(self, root, new TestDynamicScope());
do {
result = templateIterator.next();
} while (!result.done);
result = result.value;
env.commit();
return result;
}
示例5: UpdatableReference
function render<T>(template: Template<T>, context = {}, view: PathReference<Opaque> = null) {
self = new UpdatableReference(context);
env.begin();
let templateIterator = template.render(self, root, new TestDynamicScope());
do {
result = templateIterator.next();
} while (!result.done);
result = result.value;
env.commit();
assertInvariants(result);
return result;
}
示例6: render
function render(template: Template, context = {}) {
self = new UpdatableReference(context);
env.begin();
let cursor = { element: root, nextSibling: null };
let templateIterator = template.renderLayout({ env, self, cursor, dynamicScope: new TestDynamicScope() });
let iteratorResult: IteratorResult<RenderResult>;
do {
iteratorResult = templateIterator.next();
} while (!iteratorResult.done);
result = iteratorResult.value;
env.commit();
assertInvariants(result);
return result;
}