Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f78be95

Browse files
docs: add signal input test
1 parent b01a933 commit f78be95

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { render, screen } from '@testing-library/angular';
2+
import { SignalInputComponent } from './22-signal-inputs.component';
3+
import { Component } from '@angular/core';
4+
5+
test('works with signal inputs using a wrapper component', async () => {
6+
@Component({
7+
template: `
8+
<app-signal-input [greeting]="greeting" [name]="name"/>
9+
`,
10+
standalone: true,
11+
imports: [SignalInputComponent],
12+
})
13+
class WrapperComponent {
14+
greeting = 'Hello';
15+
name = 'world';
16+
}
17+
18+
await render(WrapperComponent);
19+
20+
expect(screen.getByText(/helloworld/i)).toBeInTheDocument();
21+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Component, input } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-signal-input',
5+
template: ` {{ greetings() }} {{ name() }} `,
6+
standalone: true,
7+
})
8+
export class SignalInputComponent {
9+
greetings = input<string>('', {
10+
alias: 'greeting',
11+
});
12+
name = input.required<string>();
13+
}

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"jasmine-spec-reporter": "7.0.0",
8686
"jest": "29.5.0",
8787
"jest-environment-jsdom": "29.5.0",
88-
"jest-preset-angular": "13.1.6",
88+
"jest-preset-angular": "14.0.3",
8989
"karma": "6.4.0",
9090
"karma-chrome-launcher": "^3.1.0",
9191
"karma-coverage": "^2.2.1",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /