Network Processor Module

    @refinitiv-ui/test-helpers
    TypeScript icon, indicating that this package has built-in type declarations

    6.0.3 • Public • Published

    Element Framework Test Helpers

    A collection of test helper methods for Element Framework. It uses many features from @open-wc/testing and adding some more shared utility classes to make the testing in EF easier. For more details on the methods about @open-wc/testing, please check the documentation.

    Mock Interactions

    keyboardEvent

    Returns a keyboard event. This event bubbles and is cancellable.

    • @param {string} type The type of keyboard event (such as 'keyup' or 'keydown').
    • @param {CustomKeyboardEvent} The key and modifiers for the event. Accepted values are key, shiftKey, ctrlKey, altKey, metaKey
    const event = keyboardEvent('keydown', { key: 'C', ctrlKey: true });

    Example when it's used in testing EF element.

    it('Pressing down key should open popup', async () => {
      const el = await fixture('<ef-combo-box lang="en"></ef-combo-box>');
      el.data = getData();
      await elementUpdated(el);
      const event = keyboardEvent('keydown', {
        key: 'ArrowDown'
      });
      el.dispatchEvent(event);
      await openedUpdated(el);
      expect(el.opened).to.equal(true, 'Arrow down should open popup');
    });

    Keywords

    none

    Install

    npm i @refinitiv-ui/test-helpers

    DownloadsWeekly Downloads

    39

    Version

    6.0.3

    License

    Apache-2.0

    Unpacked Size

    40.5 kB

    Total Files

    7

    Last publish

    Collaborators

    • ef-ci