How to use the @testing-library/dom.getByTestId function in @testing-library/dom

To help you get started, we’ve selected a few @testing-library/dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gitlabhq / gitlabhq / spec / frontend / authentication / two_factor_auth / index_spec.js View on Github external
it('removes `two_factor_auth_enabled_successfully` query param', () => {
      fireEvent.click(getByTestId(document.body, 'close-2fa-enabled-success-alert'));

      expect(urlUtils.updateHistory).toHaveBeenCalledWith({
        url: 'https://localhost/-/profile/account',
        title: 'foo bar',
        replace: true,
      });
    });
  });
github gitlabhq / gitlabhq / spec / frontend / members / components / table / members_table_spec.js View on Github external
const getByTestId = (id, options) =>
    createWrapper(getByTestIdHelper(wrapper.element, id, options));
github gitlabhq / gitlabhq / spec / frontend / diffs / components / diff_row_spec.js View on Github external
`('emits `stopdragging` onDrop $side side', ({ side }) => {
      const wrapper = createWrapper({ props: { line } });
      fireEvent.dragEnd(getByTestId(wrapper.element, `${side}-side`));

      expect(wrapper.emitted().stopdragging).toBeTruthy();
    });
  });
github gitlabhq / gitlabhq / spec / frontend / diffs / components / diff_row_spec.js View on Github external
`('emits `enterdragging` onDragEnter $side side', ({ side }) => {
      const expectation = { ...line[side], index: 0 };
      const wrapper = createWrapper({ props: { line } });
      fireEvent.dragEnter(getByTestId(wrapper.element, `${side}-side`));

      expect(wrapper.emitted().enterdragging).toBeTruthy();
      expect(wrapper.emitted().enterdragging[0]).toEqual([expectation]);
    });