File tree Expand file tree Collapse file tree 1 file changed +24
-5
lines changed
packages/core/test/acceptance/signal-components Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Original file line number Diff line number Diff line change 6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
+ import { Component , signal } from '@angular/core' ;
10
+ import { TestBed } from '@angular/core/testing' ;
11
+
9
12
describe ( 'listeners' , ( ) => {
10
- it ( 'should be able to invoke a listener' ,
11
- ( ) => {
12
- // todo: listener restore view was missing.
13
- // in template pipeline
14
- } ) ;
13
+ it ( 'should invoke listeners that modify context data' , ( ) => {
14
+ @Component ( {
15
+ signals : true ,
16
+ standalone : true ,
17
+ template : `<button (click)="counter.set(1)">{{counter()}}</button>` ,
18
+ } )
19
+ class App {
20
+ counter = signal ( 0 ) ;
21
+ }
22
+
23
+ const fixture = TestBed . createComponent ( App ) ;
24
+
25
+ fixture . detectChanges ( ) ;
26
+ expect ( fixture . nativeElement . textContent ) . toBe ( '0' ) ;
27
+
28
+ fixture . nativeElement . firstChild . click ( ) ;
29
+ fixture . detectChanges ( ) ;
30
+ expect ( fixture . nativeElement . textContent ) . toBe ( '1' ) ;
31
+ } ) ;
15
32
} ) ;
33
+
34
+ // todo: listener restore view was missing in template pipeline
You can’t perform that action at this time.
0 commit comments