|
6 | 6 | * found in the LICENSE file at https://angular.dev/license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -import {computed, isSignal, signal} from '@angular/core'; |
| 9 | +import {computed, input, isSignal, model, runInInjectionContext, signal} from '@angular/core'; |
| 10 | +import {createInputSignal} from '@angular/core/src/authoring/input/input_signal'; |
| 11 | +import {isInputSignal, isModelSignal} from '@angular/core/src/render3/reactivity/api'; |
| 12 | +import {TestBed} from '@angular/core/testing'; |
10 | 13 |
|
11 | 14 | describe('isSignal', () => {
|
12 | 15 | it('should return true for writable signal', () => {
|
@@ -34,3 +37,27 @@ describe('isSignal', () => {
|
34 | 37 | expect(isSignal(fn)).toBe(false);
|
35 | 38 | });
|
36 | 39 | });
|
| 40 | + |
| 41 | +describe('isInputSignal', () => { |
| 42 | + it('should return true for input signal', () => { |
| 43 | + const inputSignal = TestBed.runInInjectionContext(() => input('Angular')); |
| 44 | + expect(isInputSignal(inputSignal)).toBe(true); |
| 45 | + }); |
| 46 | + |
| 47 | + it('should return false for signal', () => { |
| 48 | + const writableSignal = signal('Angular'); |
| 49 | + expect(isInputSignal(writableSignal)).toBe(false); |
| 50 | + }); |
| 51 | +}); |
| 52 | + |
| 53 | +describe('isModelSignal', () => { |
| 54 | + it('should return true for model signal', () => { |
| 55 | + const modelSignal = TestBed.runInInjectionContext(() => model('Angular')); |
| 56 | + expect(isModelSignal(modelSignal)).toBe(true); |
| 57 | + }); |
| 58 | + |
| 59 | + it('should return false for input signal', () => { |
| 60 | + const inputSignal = createInputSignal('Angular'); |
| 61 | + expect(isModelSignal(inputSignal)).toBe(false); |
| 62 | + }); |
| 63 | +}); |
0 commit comments