How to use the @testing-library/vue.getByLabelText function in @testing-library/vue

To help you get started, we’ve selected a few @testing-library/vue 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 DefinitelyTyped / DefinitelyTyped / types / testing-library__vue / testing-library__vue-tests.ts View on Github external
component.getByText(/some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement
component.getAllByText("foo"); // $ExpectType HTMLElement[]
component.getAllByText(/some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement[]
component.queryByText("foo"); // $ExpectType HTMLElement | null
component.queryByText(/some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement | null
component.queryAllByText("foo"); // $ExpectType HTMLElement[]
component.queryAllByText(/some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement[]
component.findByText("foo"); // $ExpectType Promise
component.findByText(/some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType Promise
component.findAllByText("foo"); // $ExpectType Promise
component.findAllByText(/some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType Promise

lib.cleanup(); // $ExpectType void

// Reexports queries from dom-testing-library
lib.getByLabelText(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement
lib.getByPlaceholderText(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x}); // $ExpectType HTMLElement
lib.getByAltText(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x}); // $ExpectType HTMLElement
lib.getByTitle(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x}); // $ExpectType HTMLElement
lib.getByDisplayValue(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x}); // $ExpectType HTMLElement
lib.getByRole(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x}); // $ExpectType HTMLElement
lib.getByTestId(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x}); // $ExpectType HTMLElement
lib.getByText(elem, "foo"); // $ExpectType HTMLElement
lib.getByText(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement
lib.getAllByText(elem, "foo"); // $ExpectType HTMLElement[]
lib.getAllByText(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement[]
lib.queryByText(elem, "foo"); // $ExpectType HTMLElement | null
lib.queryByText(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement | null
lib.queryAllByText(elem, "foo"); // $ExpectType HTMLElement[]
lib.queryAllByText(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType HTMLElement[]
lib.findByText(elem, "foo"); // $ExpectType Promise
lib.findByText(elem, /some text/, {exact: true, trim: false, collapseWhitespace: true, normalizer: x => x, selector: '*'}); // $ExpectType Promise