File tree Expand file tree Collapse file tree 2 files changed +43
-2
lines changed
projects/testing-library/tests/issues Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 57
57
"@angular/compiler-cli" : " 17.1.0" ,
58
58
"@angular/forms" : " 17.1.0" ,
59
59
"@angular/language-service" : " 17.1.0" ,
60
+ "@nx/eslint" : " 17.2.8" ,
60
61
"@nx/eslint-plugin" : " 17.2.8" ,
61
62
"@nx/jest" : " 17.2.8" ,
62
63
"@nx/node" : " 17.2.8" ,
77
78
"eslint-config-prettier" : " 9.0.0" ,
78
79
"eslint-plugin-import" : " ~2.25.4" ,
79
80
"eslint-plugin-jasmine" : " ~4.1.3" ,
81
+ "eslint-plugin-jest" : " ^27.6.3" ,
80
82
"eslint-plugin-jest-dom" : " ~4.0.1" ,
81
83
"eslint-plugin-testing-library" : " ~5.0.1" ,
82
84
"jasmine-core" : " 4.2.0" ,
102
104
"semantic-release" : " ^18.0.0" ,
103
105
"ts-jest" : " 29.1.0" ,
104
106
"ts-node" : " 10.9.1" ,
105
- "typescript" : " 5.2.2" ,
106
- "@nx/eslint" : " 17.2.8"
107
+ "typescript" : " 5.2.2"
107
108
}
108
109
}
Original file line number Diff line number Diff line change
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 : / C l i c k m e / ,
36
+ } ) ;
37
+
38
+ expect ( button ) . toBeVisible ( ) ;
39
+ } ) ;
40
+ } ) ;
You can’t perform that action at this time.
0 commit comments