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


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

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


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

  @test public async 'visiting /injection-factories'(assert: Assert) {
    await visit('/injection-factories');

    assert.equal(currentURL(), '/injection-factories', 'Test page loads');
    const view = find('.mike-view');
    assert.ok(view, '.mike-view found');
    if (!view) { throw new Error(''); }
    const viewId = view.id;
    assert.ok(getViewById.call(this, viewId).get('resizeService'), 'resizeService has been injected onto views');
    const component = find('.test-component');
    assert.ok(component, '.test-component found');
    if (!component) { throw new Error(''); }
    const componentId = component.id;
    // tslint:disable-next-line:max-line-length
    assert.ok(getViewById.call(this, componentId).get('resizeService'), 'resizeService has been injected onto components');

  }
开发者ID:mike-north,项目名称:ember-resize,代码行数:17,代码来源:injection-factories-test.ts

示例4: visit

  @test async 'visiting /'(assert: Assert) {
    await visit('/');
    assert.equal(currentURL(), '/');

    const codeElement: Element | null = find('.index-view code');
    if (codeElement === null) { throw new Error('no <code>'); }
    assert.ok(/min\-width:\s[0-9]+px/.test('' + codeElement.textContent), 'min-width text found');
  }
开发者ID:mike-north,项目名称:ember-resize,代码行数:8,代码来源:index-test.ts

示例5: test

  test('toggle action shows and hides dropdown', async function(assert) {
    assert.expect(3);

    this.set('urn', nonHdfsUrn);

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

    assert.notOk(find(contentSelector), 'expected dropdown content class is hidden');

    await triggerEvent(triggerSelector, 'mouseenter');

    assert.ok(find(contentSelector), 'expected dropdown content class is shown');

    await triggerEvent(triggerSelector, 'mouseleave');

    assert.notOk(find(contentSelector), 'expected dropdown content class is hidden');
  });
开发者ID:alyiwang,项目名称:WhereHows,代码行数:19,代码来源:dataset-fabric-switcher-test.ts

示例6:

 isDisabled: () => !!find('[data-test-chat-submit][disabled]'),
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:1,代码来源:chat.ts

示例7: test

      test('an image tag is present', function(assert) {
        const img = find('img');

        assert.ok(img, 'the html tag is present');
        assert.equal(img!.getAttribute('alt'), 'Thumbnail', 'has alt text');
      });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:6,代码来源:-integration-test.ts

示例8: find

toastText: () => find(toast)!.textContent,
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:1,代码来源:app.ts


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