-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b01a933
commit f78be95
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
apps/example-app/src/app/examples/22-signal-inputs.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { render, screen } from '@testing-library/angular'; | ||
import { SignalInputComponent } from './22-signal-inputs.component'; | ||
import { Component } from '@angular/core'; | ||
|
||
test('works with signal inputs using a wrapper component', async () => { | ||
@Component({ | ||
template: ` | ||
<app-signal-input [greeting]="greeting" [name]="name"/> | ||
`, | ||
standalone: true, | ||
imports: [SignalInputComponent], | ||
}) | ||
class WrapperComponent { | ||
greeting = 'Hello'; | ||
name = 'world'; | ||
} | ||
|
||
await render(WrapperComponent); | ||
|
||
expect(screen.getByText(/hello world/i)).toBeInTheDocument(); | ||
}); |
13 changes: 13 additions & 0 deletions
13
apps/example-app/src/app/examples/22-signal-inputs.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Component, input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-signal-input', | ||
template: ` {{ greetings() }} {{ name() }} `, | ||
standalone: true, | ||
}) | ||
export class SignalInputComponent { | ||
greetings = input<string>('', { | ||
alias: 'greeting', | ||
}); | ||
name = input.required<string>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters