Skip to content

Commit 425083f

Browse files
committed
chore: remove type definitions from headings
1 parent 85819c3 commit 425083f

File tree

1 file changed

+72
-18
lines changed

1 file changed

+72
-18
lines changed

README.md

+72-18
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ when a real user uses it.
7272

7373
* [Installation](#installation)
7474
* [Usage](#usage)
75-
* [`getByLabelText(container: HTMLElement, text: TextMatch, options: {selector: string = '*', exact: boolean = true}): HTMLElement`](#getbylabeltextcontainer-htmlelement-text-textmatch-options-selector-string---exact-boolean--true-htmlelement)
76-
* [`getByPlaceholderText(container: HTMLElement, text: TextMatch, {exact: boolean = true}): HTMLElement`](#getbyplaceholdertextcontainer-htmlelement-text-textmatch-exact-boolean--true-htmlelement)
77-
* [`getByText(container: HTMLElement, text: TextMatch, {exact: boolean = true}): HTMLElement`](#getbytextcontainer-htmlelement-text-textmatch-exact-boolean--true-htmlelement)
78-
* [`getByAltText(container: HTMLElement, text: TextMatch, {exact: boolean = true}): HTMLElement`](#getbyalttextcontainer-htmlelement-text-textmatch-exact-boolean--true-htmlelement)
79-
* [`getByTestId(container: HTMLElement, text: ExactTextMatch, {exact: boolean = true}): HTMLElement`](#getbytestidcontainer-htmlelement-text-exacttextmatch-exact-boolean--true-htmlelement)
75+
* [`getByLabelText`](#getbylabeltext)
76+
* [`getByPlaceholderText`](#getbyplaceholdertext)
77+
* [`getByText`](#getbytext)
78+
* [`getByAltText`](#getbyalttext)
79+
* [`getByTestId`](#getbytestid)
8080
* [`wait`](#wait)
8181
* [`waitForElement`](#waitforelement)
82-
* [`fireEvent(node: HTMLElement, event: Event)`](#fireeventnode-htmlelement-event-event)
82+
* [`fireEvent`](#fireevent)
8383
* [Custom Jest Matchers](#custom-jest-matchers)
8484
* [Using other assertion libraries](#using-other-assertion-libraries)
8585
* [`TextMatch`](#textmatch)
@@ -182,7 +182,17 @@ test('examples of some things', async () => {
182182
})
183183
```
184184

185-
### `getByLabelText(container: HTMLElement, text: TextMatch, options: {selector: string = '*', exact: boolean = true}): HTMLElement`
185+
### `getByLabelText`
186+
187+
```typescript
188+
getByLabelText(
189+
container: HTMLElement,
190+
text: TextMatch,
191+
options?: {
192+
selector?: string = '*',
193+
exact?: boolean = true,
194+
}): HTMLElement
195+
```
186196

187197
This will search for the label that matches the given [`TextMatch`](#textmatch),
188198
then find the element associated with that label.
@@ -217,7 +227,16 @@ const inputNode = getByLabelText(container, 'username', {selector: 'input'})
217227
> want this behavior (for example you wish to assert that it doesn't exist),
218228
> then use `queryByLabelText` instead.
219229
220-
### `getByPlaceholderText(container: HTMLElement, text: TextMatch, {exact: boolean = true}): HTMLElement`
230+
### `getByPlaceholderText`
231+
232+
```typescript
233+
getByPlaceholderText(
234+
container: HTMLElement,
235+
text: TextMatch,
236+
options?: {
237+
exact?: boolean = true,
238+
}): HTMLElement
239+
```
221240

222241
This will search for all elements with a placeholder attribute and find one
223242
that matches the given [`TextMatch`](#textmatch).
@@ -230,7 +249,16 @@ const inputNode = getByPlaceholderText(container, 'Username')
230249
> NOTE: a placeholder is not a good substitute for a label so you should
231250
> generally use `getByLabelText` instead.
232251
233-
### `getByText(container: HTMLElement, text: TextMatch, {exact: boolean = true}): HTMLElement`
252+
### `getByText`
253+
254+
```typescript
255+
getByText(
256+
container: HTMLElement,
257+
text: TextMatch,
258+
options?: {
259+
exact?: boolean = true,
260+
}): HTMLElement
261+
```
234262

235263
This will search for all elements that have a text node with `textContent`
236264
matching the given [`TextMatch`](#textmatch).
@@ -240,7 +268,16 @@ matching the given [`TextMatch`](#textmatch).
240268
const aboutAnchorNode = getByText(container, 'about')
241269
```
242270

243-
### `getByAltText(container: HTMLElement, text: TextMatch, {exact: boolean = true}): HTMLElement`
271+
### `getByAltText`
272+
273+
```typescript
274+
getByAltText(
275+
container: HTMLElement,
276+
text: TextMatch,
277+
options?: {
278+
exact?: boolean = true,
279+
}): HTMLElement
280+
```
244281

245282
This will return the element (normally an `<img>`) that has the given `alt`
246283
text. Note that it only supports elements which accept an `alt` attribute:
@@ -254,7 +291,16 @@ and [`<area>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area)
254291
const incrediblesPosterImg = getByAltText(container, /incredibles.*poster$/i)
255292
```
256293

257-
### `getByTestId(container: HTMLElement, text: ExactTextMatch, {exact: boolean = true}): HTMLElement`
294+
### `getByTestId`
295+
296+
```typescript
297+
getByTestId(
298+
container: HTMLElement,
299+
text: ExactTextMatch,
300+
options?: {
301+
exact?: boolean = true,
302+
}): HTMLElement`
303+
```
258304

259305
A shortcut to `` container.querySelector(`[data-testid="${yourId}"]`) `` (and it
260306
also accepts an [`ExactTextMatch`](#exacttextmatch)).
@@ -274,8 +320,6 @@ const usernameInputElement = getByTestId(container, 'username-input')
274320

275321
### `wait`
276322

277-
Defined as:
278-
279323
```typescript
280324
function wait(
281325
callback?: () => void,
@@ -317,8 +361,6 @@ intervals.
317361

318362
### `waitForElement`
319363

320-
Defined as:
321-
322364
```typescript
323365
function waitForElement<T>(
324366
callback?: () => T | null | undefined,
@@ -377,7 +419,11 @@ The default `timeout` is `4500ms` which will keep you under
377419
additions and removals of child elements (including text nodes) in the `container` and any of its descendants.
378420
It won't detect attribute changes unless you add `attributes: true` to the options.
379421

380-
### `fireEvent(node: HTMLElement, event: Event)`
422+
### `fireEvent`
423+
424+
```typescript
425+
fireEvent(node: HTMLElement, event: Event)
426+
```
381427

382428
Fire DOM events.
383429

@@ -392,7 +438,11 @@ fireEvent(
392438
)
393439
```
394440

395-
#### `fireEvent[eventName](node: HTMLElement, eventProperties: Object)`
441+
#### `fireEvent[eventName]`
442+
443+
```typescript
444+
fireEvent[eventName](node: HTMLElement, eventProperties: Object)
445+
```
396446

397447
Convenience methods for firing DOM events. Check out
398448
[src/events.js](https://github.com/kentcdodds/dom-testing-library/blob/master/src/events.js)
@@ -405,7 +455,11 @@ fireEvent.click(getElementByText('Submit'), rightClick)
405455
// default `button` property for click events is set to `0` which is a left click.
406456
```
407457

408-
#### `getNodeText(node: HTMLElement)`
458+
#### `getNodeText`
459+
460+
```typescript
461+
getNodeText(node: HTMLElement)
462+
```
409463

410464
Returns the complete text content of a html element, removing any extra
411465
whitespace. The intention is to treat text in nodes exactly as how it is

0 commit comments

Comments
 (0)