|
8 | 8 |
|
9 | 9 | import {Injector, signal} from '@angular/core'; |
10 | 10 | import {TestBed} from '@angular/core/testing'; |
11 | | -import {customError, form, max, maxError} from '../../../../public_api'; |
| 11 | +import {form, max, maxError} from '../../../../public_api'; |
12 | 12 |
|
13 | 13 | describe('max validator', () => { |
14 | 14 | it('returns max error when the value is larger', () => { |
@@ -58,19 +58,19 @@ describe('max validator', () => { |
58 | 58 | (p) => { |
59 | 59 | max(p.age, 5, { |
60 | 60 | error: ({value}) => { |
61 | | - return customError({kind: 'special-max', message: value()?.toString()}); |
| 61 | + return {kind: 'special-max', message: value()?.toString()}; |
62 | 62 | }, |
63 | 63 | }); |
64 | 64 | }, |
65 | 65 | {injector: TestBed.inject(Injector)}, |
66 | 66 | ); |
67 | 67 |
|
68 | 68 | expect(f.age().errors()).toEqual([ |
69 | | - customError({ |
| 69 | + { |
70 | 70 | kind: 'special-max', |
71 | 71 | message: '6', |
72 | 72 | fieldTree: f.age, |
73 | | - }), |
| 73 | + }, |
74 | 74 | ]); |
75 | 75 | }); |
76 | 76 |
|
@@ -103,16 +103,14 @@ describe('max validator', () => { |
103 | 103 | error: ({value, valueOf}) => { |
104 | 104 | return valueOf(p.name) === 'disabled' |
105 | 105 | ? [] |
106 | | - : customError({kind: 'special-max', message: value()?.toString()}); |
| 106 | + : {kind: 'special-max', message: value()?.toString()}; |
107 | 107 | }, |
108 | 108 | }); |
109 | 109 | }, |
110 | 110 | {injector: TestBed.inject(Injector)}, |
111 | 111 | ); |
112 | 112 |
|
113 | | - expect(f.age().errors()).toEqual([ |
114 | | - customError({kind: 'special-max', message: '6', fieldTree: f.age}), |
115 | | - ]); |
| 113 | + expect(f.age().errors()).toEqual([{kind: 'special-max', message: '6', fieldTree: f.age}]); |
116 | 114 | f.name().value.set('disabled'); |
117 | 115 | expect(f.age().errors()).toEqual([]); |
118 | 116 | }); |
@@ -154,7 +152,7 @@ describe('max validator', () => { |
154 | 152 | (p) => { |
155 | 153 | max(p.age, 5, { |
156 | 154 | error: ({value}) => { |
157 | | - return customError({kind: 'special-max', message: value()?.toString()}); |
| 155 | + return {kind: 'special-max', message: value()?.toString()}; |
158 | 156 | }, |
159 | 157 | }); |
160 | 158 | }, |
|
0 commit comments