當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。