當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript TestEnvironment.commit方法代碼示例

本文整理匯總了TypeScript中@glimmer/test-helpers.TestEnvironment.commit方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TestEnvironment.commit方法的具體用法?TypeScript TestEnvironment.commit怎麽用?TypeScript TestEnvironment.commit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@glimmer/test-helpers.TestEnvironment的用法示例。


在下文中一共展示了TestEnvironment.commit方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

QUnit.test("HTML tags re-rendered", function(assert) {
  let template = compile("<h1>hello!</h1><div>content</div>");
  let result = render(template, {});

  env.begin();
  result.rerender();
  env.commit();

  assert.equal(serializer.serializeChildren(root), "<h1>hello!</h1><div>content</div>");
});
開發者ID:asakusuma,項目名稱:glimmer,代碼行數:10,代碼來源:node-test.ts

示例2: 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;
}
開發者ID:asakusuma,項目名稱:glimmer,代碼行數:13,代碼來源:node-test.ts

示例3: 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;
}
開發者ID:jayphelps,項目名稱:glimmer,代碼行數:13,代碼來源:style-warning-test.ts

示例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;
}
開發者ID:asakusuma,項目名稱:glimmer,代碼行數:13,代碼來源:debugger-test.ts

示例5: 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>");
    });
開發者ID:asakusuma,項目名稱:glimmer,代碼行數:13,代碼來源:initial-render-test.ts

示例6: 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;
}
開發者ID:asakusuma,項目名稱:glimmer,代碼行數:14,代碼來源:attributes-test.ts

示例7: 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;
}
開發者ID:jayphelps,項目名稱:glimmer,代碼行數:15,代碼來源:attributes-test.ts

示例8: rerender

function rerender(context: any = null) {
  if (context !== null) self.update(context);
  env.begin();
  result.rerender();
  env.commit();
}
開發者ID:jayphelps,項目名稱:glimmer,代碼行數:6,代碼來源:attributes-test.ts

示例9:

 assert.throws(() => env.commit(), 'something failed'); // commit failed
開發者ID:jayphelps,項目名稱:glimmer,代碼行數:1,代碼來源:env-test.ts


注:本文中的@glimmer/test-helpers.TestEnvironment.commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。