Skip to content

How to get getElementError function in Custom Query  #508

Closed
@Yama-Tomo

Description

@Yama-Tomo

I have created custom query using this document.
https://testing-library.com/docs/dom-testing-library/api-helpers#custom-queries
But not found function getElementError in the queryHelpers.

I found the deletion of the declaration in #452.
Is the code below correct to do this?

// Hmmm.. `getConfig` is not exported at the entry point.
const config = require('@testing-library/dom/dist/config')

export function getMyCustomElement(container) {
  ... snip ...
  if (!element) {
    throw config.getConfig().getElementError(`Unable to find an element....`, container)
  }
  ... snip ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions