MCPcopy Create free account
hub / github.com/angular/angular / TestStrategy

Class TestStrategy

packages/elements/test/create-custom-element_spec.ts:400–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398 }
399
400 class TestStrategy implements NgElementStrategy {
401 connectedElement: HTMLElement | null = null;
402 disconnectCalled = false;
403 inputs = new Map<string, any>();
404
405 events = new Subject<NgElementStrategyEvent>();
406
407 connect(element: HTMLElement): void {
408 this.events.next({name: 'strategy-event', value: 'connect'});
409 this.connectedElement = element;
410 }
411
412 disconnect(): void {
413 this.disconnectCalled = true;
414 }
415
416 getInputValue(propName: string): any {
417 return this.inputs.get(propName);
418 }
419
420 setInputValue(propName: string, value: string, transform?: (value: any) => any): void {
421 this.inputs.set(propName, transform ? transform(value) : value);
422 }
423
424 reset(): void {
425 this.connectedElement = null;
426 this.disconnectCalled = false;
427 this.inputs.clear();
428 }
429 }
430
431 class TestStrategyFactory implements NgElementStrategyFactory {
432 testStrategy = new TestStrategy();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected