Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
Angualr testing library fails with special character

In my testing if I use the special character it fails. I am doing the escape but still it fails, here is my test.

import { ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MaterialModule } from '@hf-workspace/material';
import { render, screen } from '@testing-library/angular';

import { FormAdduserComponent } from './form-add.component';

const formImports = [
  ReactiveFormsModule,
  BrowserAnimationsModule,
  MaterialModule,
];



it('should render the FormAdduserComponent', async () => {
  await render(FormAdduserComponent, {
    imports: formImports,
  });
});

it('should render the Form ', async () => {
  await render(FormAdduserComponent, {
    imports: formImports,
  });
  expect(screen.getByRole('form')).toBeInTheDocument();
});

it('should render all Form elements ', async () => {
  await render(FormAdduserComponent, {
    imports: formImports,
    componentProperties: { schema: schemaAddUser },
  });
  const x = 'Set AM/PM';
  expect(screen.getByLabelText(/Time Format/i)).toBeInTheDocument();
  expect(screen.getByLabelText(/Set Time/i)).toBeInTheDocument();
  expect(screen.getByLabelText(/Set AM\/\PM/i)).toBeInTheDocument();//fails
  expect(screen.getByLabelText(/Address1/i)).toBeInTheDocument();
  expect(screen.getByLabelText(/Address2/i)).toBeInTheDocument();
  expect(screen.getByLabelText(/Address3/i)).toBeInTheDocument();
  expect(screen.getByLabelText(/Country/i)).toBeInTheDocument();
  expect(screen.getByLabelText(/City/i)).toBeInTheDocument();
  expect(screen.getByLabelText(/State\/\Province/i)).toBeInTheDocument();//fails
});

how to use the special characters?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda