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?