• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript test-helpers.render函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@ember/test-helpers.render函数的典型用法代码示例。如果您正苦于以下问题:TypeScript render函数的具体用法?TypeScript render怎么用?TypeScript render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了render函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: test

  test('property rendering', async function(assert) {
    const time = new Date().getTime();
    const actor = 'John Appleseed';
    const title = 'Last Modified';

    this.set('time', time);
    this.set('actor', actor);
    this.set('title', title);

    await render(hbs`{{last-saved-by time=time actor=actor}}`);

    assert.ok(this.element.textContent!.includes(moment(time).fromNow()), 'it shows the last saved time from now');
    assert.ok(this.element.textContent!.includes(actor), 'it shows the actor attribute');

    await render(hbs`{{last-saved-by time=time title=title}}`);

    assert.ok(this.element.textContent!.includes('Last Modified'), 'it shows the passed in title');
    assert.ok(!this.element.textContent!.includes('Last Saved:'), 'it does not show the default title');

    await render(hbs`
      {{#last-saved-by time=time title=title actor=actor as |ls|}}
        <div class="yielded-title">{{ls.title}}</div>
        <div class="yielded-actor">{{ls.actor}}</div>
      {{/last-saved-by}}
    `);

    assert.equal(find('.yielded-title')!.textContent!.trim(), title, 'block usage yields the title');
    assert.equal(find('.yielded-actor')!.textContent!.trim(), actor, 'block usage yields the actor');
  });
开发者ID:alyiwang,项目名称:WhereHows,代码行数:29,代码来源:last-saved-by-test.ts


示例2: test

test('DOM interactions', async () => {
    await render(hbs`<div class="message">Hello, world</div>`);

    await click('.message');
    await doubleClick('.message');
    await tap('.message');
    await focus('.message');
    await blur('.message');
    await triggerEvent('.message', 'custom-event');
    await triggerKeyEvent('.message', 'keydown', 'Enter', { ctrlKey: true });
    await fillIn('.message', 'content');

    const messageElement = find('.message')!;
    await click(messageElement);
    await doubleClick(messageElement);
    await tap(messageElement);
    await focus(messageElement);
    await blur(messageElement);
    await triggerEvent(messageElement, 'custom-event');
    await triggerKeyEvent(messageElement, 'keydown', 'Enter', { ctrlKey: true });
    await fillIn(messageElement, 'content');
    await typeIn(messageElement, 'content');

    const allMessages = findAll('.message');
    for (const element of allMessages) {
        await click(element);
    }

    const root = getRootElement();
    await click(root);
});
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:31,代码来源:ember__test-helpers-tests.ts


示例3: test

  test('onTypeahead', async function(this: ITestWithMirageContext, assert) {
    const apiHandler = getMirageHandle(this, '/api/v1/autocomplete/datasets', 'get');
    assert.expect(6);

    containerComponentTest(this, async (component: IContainerStub) => {
      // dont return anything with less than 3
      const results1 = await component.onTypeahead('h');
      assert.equal(results1.length, 0);

      // return list
      const results2 = await component.onTypeahead('hol');
      assert.ok(results2.length > 0);

      // cache return
      const results3 = await component.onTypeahead('hol');
      assert.ok(results3.length > 0);
      assert.equal(apiHandler.numberOfCalls, 1, 'cached return');

      // debounce
      component.onTypeahead('hola');
      component.onTypeahead('hola ');
      const results4 = await component.onTypeahead('hola nacho');
      assert.ok(results4.length > 0);
      assert.equal(apiHandler.numberOfCalls, 2, 'App debounces calls');
    });

    await render(hbs`
      {{#search/containers/search-box  as |keyword placeholder onTypeahead onSearch|}}
        {{container-stub onTypeahead=(action onTypeahead)}}
      {{/search/containers/search-box}}
    `);
  });
开发者ID:alyiwang,项目名称:WhereHows,代码行数:32,代码来源:search-box-test.ts


示例4: test

  test('component yielding with a urn', async function(assert) {
    assert.expect(1);

    const { server }: any = this;
    const upstreamCount = 3;

    server.createList('datasetView', upstreamCount);

    this.set('urn', nonHdfsUrn);

    await render(hbs`
      {{#datasets/containers/dataset-lineage-upstreams urn=urn as |container|}}
        <ul class="container-list">
          {{#each container.upstreams}}
            <li></li>
          {{/each}}
        </ul>
      {{/datasets/containers/dataset-lineage-upstreams}}
    `);

    assert.equal(
      findAll('.container-list li')!.length,
      upstreamCount,
      'expect component to yield each upstream dataset'
    );
  });
开发者ID:alyiwang,项目名称:WhereHows,代码行数:26,代码来源:dataset-lineage-upstreams-test.ts


示例5: render

  @test async 'it renders when used in {{inline-form}}'(assert: Assert) {
    // Set any properties with this.set('myProperty', 'value');
    // Handle any actions with this.set('myAction', function(val) { ... });

    await render(hbs`{{x-foo}}`);

    assert.equal(('' + this.element.textContent).trim(), '');
  }
开发者ID:mike-north,项目名称:ember-resize,代码行数:8,代码来源:x-foo-test.ts


示例6: function

      hooks.beforeEach(async function(this: TestContext) {
        this.set('someUrl', 'https://i.imgur.com/gCyUdeb.gifv');

        await render(hbs`
                     {{chat-history/message/embedded-resource
                      url=someUrl}}
                     `);
      });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:8,代码来源:component-integration-test.ts


示例7: render

  @test async 'it renders when used in {{inline-form}}'(assert: Assert) {
    // Set any properties with this.set('myProperty', 'value');
    // Handle any actions with this.set('myAction', function(val) { ... });

    await render(hbs`{{no-service-injected}}`);

    assert.equal(('' + this.element.textContent).trim(), 'Is the resize service automatically injected? false');
  }
开发者ID:mike-north,项目名称:ember-resize,代码行数:8,代码来源:no-service-injected-test.ts


示例8: test

  test('component rendering', async function(assert) {
    assert.expect(1);

    await render(hbs`
      {{datasets/dataset-fabric-switcher}}
    `);

    assert.ok(this.element.querySelector('.dataset-fabric-switcher'), 'expected component class exists in DOM');
  });
开发者ID:alyiwang,项目名称:WhereHows,代码行数:9,代码来源:dataset-fabric-switcher-test.ts


示例9: render

  @test
  async 'it renders when used in {{inline-form}}'(assert: Assert) {
    // Set any properties with this.set('myProperty', 'value');
    // Handle any actions with this.set('myAction', function(val) { ... });

    await render(hbs`{{ember-oembed src='http://soundcloud.com/forss/flickermood'}}`);

    assert.equal(('' + this.element.textContent).trim(), '');
  }
开发者ID:levanto-financial,项目名称:ember-oembed,代码行数:9,代码来源:ember-oembed-test.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript test-helpers.settled函数代码示例发布时间:2022-05-28
下一篇:
TypeScript test-helpers.getContext函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap