Skip to content

Commit f549e57

Browse files
committed
fix positioning
1 parent c565dbc commit f549e57

File tree

1 file changed

+76
-73
lines changed
  • docs/angular-testing-library

1 file changed

+76
-73
lines changed

docs/angular-testing-library/api.mdx

+76-73
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,44 @@ export async function render<WrapperType = WrapperComponent>(
7676

7777
## Component RenderOptions
7878

79+
80+
### `inputs`
81+
82+
An object to set `@Input` or `input()` properties of the component.
83+
84+
**default** : `{}`
85+
86+
```typescript
87+
await render(AppComponent, {
88+
inputs: {
89+
counterValue: 10,
90+
// explicitly define aliases using `aliasedInput`
91+
...aliasedInput('someAlias', 'someValue'),
92+
},
93+
})
94+
```
95+
96+
### `on`
97+
98+
An object with callbacks to subscribe to `EventEmitters` and `Observables` of
99+
the component.
100+
101+
**default** : `{}`
102+
103+
```ts
104+
// using a manual callback
105+
const sendValue = (value) => { ... }
106+
// using a (jest) spy
107+
const sendValueSpy = jest.fn()
108+
109+
await render(AppComponent, {
110+
on: {
111+
send: (value) => sendValue(value),
112+
send: sendValueSpy
113+
}
114+
})
115+
```
116+
79117
### `declarations`
80118

81119
A collection of components, directives and pipes needed to render the component.
@@ -348,45 +386,66 @@ await render(AppComponent, {
348386
})
349387
```
350388

351-
## `RenderResult`
352389

353-
### `inputs`
390+
### ~~`componentInputs`~~ (deprecated)
354391

355-
An object to set `@Input` or `input()` properties of the component.
392+
An object to set `@Input` properties of the component. Uses `setInput` to set
393+
the input property. Throws if the component property is not annotated with the
394+
`@Input` attribute.
356395

357396
**default** : `{}`
358397

398+
**example**:
399+
359400
```typescript
360401
await render(AppComponent, {
361-
inputs: {
402+
componentInputs: {
362403
counterValue: 10,
363-
// explicitly define aliases using `aliasedInput`
364-
...aliasedInput('someAlias', 'someValue'),
365404
},
366405
})
367406
```
368407

369-
### `on`
408+
### ~~`componentOutputs`~~ (deprecated)
370409

371-
An object with callbacks to subscribe to `EventEmitters` and `Observables` of
372-
the component.
410+
An object to set `@Output` properties of the component.
373411

374412
**default** : `{}`
375413

376-
```ts
377-
// using a manual callback
378-
const sendValue = (value) => { ... }
379-
// using a (jest) spy
380-
const sendValueSpy = jest.fn()
414+
**example**:
381415

416+
```typescript
382417
await render(AppComponent, {
383-
on: {
384-
send: (value) => sendValue(value),
385-
send: sendValueSpy
418+
componentOutputs: {
419+
clicked: (value) => { ... }
386420
}
387421
})
388422
```
389423

424+
### ~~`componentProperties`~~ (deprecated)
425+
426+
An object to set `@Input` and `@Output` properties of the component. Doesn't
427+
have a fine-grained control as `inputs` and `on`.
428+
429+
**default** : `{}`
430+
431+
**example**:
432+
433+
```typescript
434+
await render(AppComponent, {
435+
componentProperties: {
436+
// an input
437+
counterValue: 10,
438+
// an output
439+
send: (value) => { ... }
440+
// a public property
441+
name: 'Tim'
442+
}
443+
})
444+
```
445+
446+
447+
## `RenderResult`
448+
390449
### `container`
391450

392451
The containing DOM node of your rendered Angular Component. This is a regular
@@ -530,59 +589,3 @@ expect(screen.getByText(/loading/i)).toBeInTheDocument()
530589
await renderDeferBlock(DeferBlockState.Complete)
531590
expect(screen.getByText(/completed/i)).toBeInTheDocument()
532591
```
533-
534-
### ~~`componentInputs`~~ (deprecated)
535-
536-
An object to set `@Input` properties of the component. Uses `setInput` to set
537-
the input property. Throws if the component property is not annotated with the
538-
`@Input` attribute.
539-
540-
**default** : `{}`
541-
542-
**example**:
543-
544-
```typescript
545-
await render(AppComponent, {
546-
componentInputs: {
547-
counterValue: 10,
548-
},
549-
})
550-
```
551-
552-
### ~~`componentOutputs`~~ (deprecated)
553-
554-
An object to set `@Output` properties of the component.
555-
556-
**default** : `{}`
557-
558-
**example**:
559-
560-
```typescript
561-
await render(AppComponent, {
562-
componentOutputs: {
563-
clicked: (value) => { ... }
564-
}
565-
})
566-
```
567-
568-
### ~~`componentProperties`~~ (deprecated)
569-
570-
An object to set `@Input` and `@Output` properties of the component. Doesn't
571-
have a fine-grained control as `inputs` and `on`.
572-
573-
**default** : `{}`
574-
575-
**example**:
576-
577-
```typescript
578-
await render(AppComponent, {
579-
componentProperties: {
580-
// an input
581-
counterValue: 10,
582-
// an output
583-
send: (value) => { ... }
584-
// a public property
585-
name: 'Tim'
586-
}
587-
})
588-
```

0 commit comments

Comments
 (0)