-
- it('should convert hero name to Title Case', () => {
- // get the name's input and display elements from the DOM
- const hostElement = fixture.nativeElement;
- const nameInput: HTMLInputElement = hostElement.querySelector('input');
- const nameDisplay: HTMLElement = hostElement.querySelector('span');
-
- // simulate user entering a new name into the input box
- nameInput.value = 'quick BROWN fOx';
-
- // dispatch a DOM event so that Angular learns of input value change.
- nameInput.dispatchEvent(newEvent('input'));
-
- // Tell Angular to update the display binding through the title pipe
- fixture.detectChanges();
-
- expect(nameDisplay.textContent).toBe('Quick Brown Fox');
- });
-