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


TypeScript glimmer-test-helpers.TestEnvironment類代碼示例

本文整理匯總了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>&lt;hi&gt;</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;未經允許,請勿轉載。