File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -101,19 +101,19 @@ counter.component.ts
101
101
selector: ' app-counter' ,
102
102
template: `
103
103
<button (click)="decrement()">-</button>
104
- <span>Current Count: {{ counter }}</span>
104
+ <span>Current Count: {{ counter() }}</span>
105
105
<button (click)="increment()">+</button>
106
106
` ,
107
107
})
108
108
export class CounterComponent {
109
- @ Input () counter = 0 ;
109
+ counter = model ( 0 ) ;
110
110
111
111
increment() {
112
- this .counter += 1 ;
112
+ this .counter . set ( this . counter () + 1 ) ;
113
113
}
114
114
115
115
decrement() {
116
- this .counter -= 1 ;
116
+ this .counter . set ( this . counter () + 1 ) ;
117
117
}
118
118
}
119
119
```
@@ -126,13 +126,13 @@ import { CounterComponent } from './counter.component';
126
126
127
127
describe (' Counter' , () => {
128
128
test (' should render counter' , async () => {
129
- await render (CounterComponent , { componentProperties : { counter: 5 } });
129
+ await render (CounterComponent , { inputs : { counter: 5 } });
130
130
131
131
expect (screen .getByText (' Current Count: 5' ));
132
132
});
133
133
134
134
test (' should increment the counter on click' , async () => {
135
- await render (CounterComponent , { componentProperties : { counter: 5 } });
135
+ await render (CounterComponent , { inputs : { counter: 5 } });
136
136
137
137
const incrementButton = screen .getByRole (' button' , { name: ' +' });
138
138
fireEvent .click (incrementButton );
You can’t perform that action at this time.
0 commit comments