Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!