Skip to content

refactor(jest matchers): move custom matchers to dedicated file and export

Peter Hegman requested to merge export-have-focus-matcher into master

What does this MR do?

Follow up from this comment: !1522 (comment 370483614)

Moves custom matchers to a dedicated matchers.js file and exports each matcher individually. This will allow us to import the matchers in spec/frontend/matchers.js for use in the GitLab codebase:

import { toHaveFocus } from '@gitlab/ui/dist/matchers';

export default {
  toHaveSpriteIcon: (element, iconName) => {
    // existing code
  },
  toMatchInterpolatedText(received, match) {
    // existing code
  },
  toHaveFocus,
};

Does this MR meet the acceptance criteria?

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidlines.
  • [-] If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • [-] If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • [-] If the MR changes a component's API, integration MR(s) have been opened in the following projects to ensure that the @gitlab/ui package can be upgraded quickly after the changes are released:
  • [-] Added the ~"component:*" label(s) if applicable.
Edited by Peter Hegman

Merge request reports