MCPcopy Index your code
hub / github.com/angular/angular / testContext

Function testContext

packages/forms/signals/test/node/field_context.spec.ts:23–42  ·  view source on GitHub ↗
(
  s: WritableSignal<T>,
  callback: (ctx: FieldContext<T>, p: SchemaPathTree<T>) => void,
)

Source from the content-addressed store, hash-verified

21} from '../../public_api';
22
23function testContext<T>(
24 s: WritableSignal<T>,
25 callback: (ctx: FieldContext<T>, p: SchemaPathTree<T>) => void,
26) {
27 const isCalled = jasmine.createSpy();
28
29 TestBed.runInInjectionContext(() => {
30 const f = form<T>(s, (p) => {
31 validate(p as SchemaPath<T>, (ctx) => {
32 callback(ctx, p);
33 isCalled();
34 return undefined;
35 });
36 });
37
38 f().errors();
39 });
40
41 expect(isCalled).toHaveBeenCalled();
42}
43
44describe('Field Context', () => {
45 it('value', () => {

Callers 1

Calls 5

formFunction · 0.85
runInInjectionContextMethod · 0.65
validateFunction · 0.50
callbackFunction · 0.50
errorsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…