MCPcopy
hub / github.com/angular/components / TestMainComponent

Class TestMainComponent

src/cdk/testing/tests/test-main-component.ts:31–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 imports: [TestShadowBoundary, TestSubComponent, FormsModule, ReactiveFormsModule],
30})
31export class TestMainComponent implements OnDestroy {
32 private _cdr = inject(ChangeDetectorRef);
33 private _zone = inject(NgZone);
34
35 username: string;
36 counter: number;
37 asyncCounter: number;
38 input!: string;
39 memo: string;
40 testTools: string[];
41 testMethods: string[];
42 isHovering = false;
43 isPointerOver = false;
44 specialKey = '';
45 modifiers!: string;
46 singleSelect!: string;
47 singleSelectChangeEventCount = 0;
48 multiSelect: string[] = [];
49 multiSelectChangeEventCount = 0;
50 basicEvent = 0;
51 customEventData: string | null = null;
52 _shadowDomSupported = _supportsShadowDom();
53 clickResult = {x: -1, y: -1};
54 rightClickResult = {x: -1, y: -1, button: -1};
55 numberControl = new FormControl<number | null>(null);
56
57 @ViewChild('clickTestElement') clickTestElement!: ElementRef<HTMLElement>;
58 @ViewChild('taskStateResult') taskStateResultElement!: ElementRef<HTMLElement>;
59
60 private _fakeOverlayElement: HTMLElement;
61
62 constructor() {
63 this.username = 'Yi';
64 this.counter = 0;
65 this.asyncCounter = 0;
66 this.memo = '';
67 this.testTools = ['Protractor', 'TestBed', 'Other'];
68 this.testMethods = ['Unit Test', 'Integration Test', 'Performance Test', 'Mutation Test'];
69 setTimeout(() => {
70 this.asyncCounter = 5;
71 this._cdr.markForCheck();
72 }, 1000);
73
74 this._fakeOverlayElement = document.createElement('div');
75 this._fakeOverlayElement.classList.add('fake-overlay');
76 this._fakeOverlayElement.innerText = 'This is a fake overlay.';
77 document.body.appendChild(this._fakeOverlayElement);
78 }
79
80 ngOnDestroy() {
81 this._fakeOverlayElement.remove();
82 }
83
84 click() {
85 this.counter++;
86 setTimeout(() => {
87 this.asyncCounter++;
88 this._cdr.markForCheck();

Callers

nothing calls this directly

Calls 1

_supportsShadowDomFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…