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 b01a933

Browse files
1 parent 87d02f2 commit b01a933

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

‎package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@angular/compiler-cli": "17.1.0",
5858
"@angular/forms": "17.1.0",
5959
"@angular/language-service": "17.1.0",
60+
"@nx/eslint": "17.2.8",
6061
"@nx/eslint-plugin": "17.2.8",
6162
"@nx/jest": "17.2.8",
6263
"@nx/node": "17.2.8",
@@ -77,6 +78,7 @@
7778
"eslint-config-prettier": "9.0.0",
7879
"eslint-plugin-import": "~2.25.4",
7980
"eslint-plugin-jasmine": "~4.1.3",
81+
"eslint-plugin-jest": "^27.6.3",
8082
"eslint-plugin-jest-dom": "~4.0.1",
8183
"eslint-plugin-testing-library": "~5.0.1",
8284
"jasmine-core": "4.2.0",
@@ -102,7 +104,6 @@
102104
"semantic-release": "^18.0.0",
103105
"ts-jest": "29.1.0",
104106
"ts-node": "10.9.1",
105-
"typescript": "5.2.2",
106-
"@nx/eslint": "17.2.8"
107+
"typescript": "5.2.2"
107108
}
108109
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { CommonModule } from '@angular/common';
2+
import { BehaviorSubject } from 'rxjs';
3+
import { Component, Inject, Injectable } from '@angular/core';
4+
import { screen, render } from '../../src/public_api';
5+
6+
// Service
7+
@Injectable()
8+
class DemoService {
9+
buttonTitle = new BehaviorSubject<string>('Click me');
10+
}
11+
12+
// Component
13+
@Component({
14+
selector: 'atl-issue-435',
15+
standalone: true,
16+
imports: [CommonModule],
17+
providers: [DemoService],
18+
template: `
19+
<button>
20+
<!-- 👇 I only get the Inject error when I use the async pipe here -->
21+
{{ demoService.buttonTitle | async }}
22+
</button>
23+
`,
24+
})
25+
class DemoComponent {
26+
constructor(@Inject(DemoService) public demoService: DemoService) {}
27+
}
28+
29+
// Test
30+
describe('DemoComponent', () => {
31+
it('should render button', async () => {
32+
await render(DemoComponent);
33+
34+
const button = screen.getByRole('button', {
35+
name: /Clickme/,
36+
});
37+
38+
expect(button).toBeVisible();
39+
});
40+
});

0 commit comments

Comments
(0)

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