- Crea una variable llamada
nombre
y asígnale tu nombre. - Declara una variable
edad
y asígnale tu edad. - Crea una variable
estaLloviendo
y asígnale un valor booleano que represente si está lloviendo o no. - Declara una variable
num1
y otranum2
, y luego suma estos dos números y almacena el resultado en una tercera variable llamadasuma
. - Crea una variable
frutas
como un array que contenga tres nombres de frutas.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { queryById, query } from './finder'; | |
import { ComponentFixture } from '@angular/core/testing'; | |
export function setInputValue<T>( | |
fixture: ComponentFixture<T>, | |
selector: string, | |
value: string, | |
withTestById = false | |
) { | |
const inputDe = withTestById ? queryById(fixture, selector) : query(fixture, selector); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ComponentFixture } from '@angular/core/testing'; | |
import { queryByTestId, query } from './finder'; | |
export function clickEvent<T>( | |
fixture: ComponentFixture<T>, | |
selector: string, | |
withTestId = false, | |
eventName = 'click', | |
event: unknown = null | |
) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defer, of } from 'rxjs'; | |
export function asyncData<T>(data: T) { | |
return defer(() => Promise.resolve(data)); | |
} | |
export function asyncError(error: unknown) { | |
return defer(() => Promise.reject(error)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { By } from '@angular/platform-browser'; | |
import { ComponentFixture } from '@angular/core/testing'; | |
import { Type, DebugElement } from '@angular/core'; | |
export function query<T>( | |
fixture: ComponentFixture<T>, | |
selector: string, | |
canReturnError = true | |
) { | |
const elementDe = fixture.debugElement.query(By.css(selector)); |