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


TypeScript TestEnvironment.begin方法代码示例

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


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

QUnit.test('ensure commit cleans up when it can', assert => {
  let env = new TestEnvironment();
  env.begin();

  // ghetto stub
  Object.defineProperty(env, 'transaction', {
    get() {
      return {
        scheduledInstallManagers() : void { },
        commit() : void {
          throw new Error('something failed');
        }
      };
    }
  });

  assert.throws(() => env.commit(), 'something failed'); // commit failed

  // but a previous commit failing, does not cause a future transaction to fail to start
  env.begin();
});
开发者ID:jayphelps,项目名称:glimmer,代码行数:21,代码来源:env-test.ts

示例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;
}
开发者ID:asakusuma,项目名称:glimmer,代码行数:13,代码来源:node-test.ts

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10:

 assert.throws(() => env.begin(), 'a glimmer transaction was begun, but one already exists. You may have a nested transaction');
开发者ID:jayphelps,项目名称:glimmer,代码行数:1,代码来源:env-test.ts


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