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


TypeScript test-helpers.triggerEvent函數代碼示例

本文整理匯總了TypeScript中@ember/test-helpers.triggerEvent函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript triggerEvent函數的具體用法?TypeScript triggerEvent怎麽用?TypeScript triggerEvent使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了triggerEvent函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

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

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

示例3: test

  test('pressing enter should trigger search and suggestion box should go away', async function(
    this: ISearchBoxTestContext,
    assert
  ) {
    const searchOptions = ['one', 'two'];
    const expectedSearch = 'expected search';
    let searchedWord = '';
    const onSearch = (word: string) => {
      searchedWord = word;
    };

    await getBaseTest(this, { text: expectedSearch, onSearch, onTypeahead: async () => searchOptions });
    await focusInput();
    await triggerEvent('form', 'submit');
    await assert.equal(searchedWord, expectedSearch);

    assert.equal(querySelectorAll(this, '.ember-power-select-option').length, 0);
  });
開發者ID:alyiwang,項目名稱:WhereHows,代碼行數:18,代碼來源:search-box-test.ts

示例4: function

 hooks.beforeEach(async function() {
   await app.footer.faq().scrollIntoView(false);
   await triggerEvent(window as any, 'scroll');
 });
開發者ID:NullVoxPopuli,項目名稱:emberclear,代碼行數:4,代碼來源:navigation-scroll-to-top-test.ts

示例5: async

const blurInput = async () => {
  await click('button'); // Blur
  await triggerEvent(inputSelector, 'blur');
};
開發者ID:alyiwang,項目名稱:WhereHows,代碼行數:4,代碼來源:search-box-test.ts

示例6: function

 hooks.beforeEach(async function() {
   triggerEvent(chat.selectors.form, 'submit');
   await waitFor(chat.selectors.submitButton + '[disabled]');
 });
開發者ID:NullVoxPopuli,項目名稱:emberclear,代碼行數:4,代碼來源:-acceptance-test.ts


注:本文中的@ember/test-helpers.triggerEvent函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。