@@ -365,8 +365,7 @@ describe('MatInput without forms', () => {
365
365
366
366
expect ( inputEl . placeholder ) . toBe ( 'Other placeholder' ) ;
367
367
expect ( labelEl ) . not . toBeNull ( ) ;
368
- expect ( labelEl . nativeElement . textContent ) . toMatch ( 'Other placeholder' ) ;
369
- expect ( labelEl . nativeElement . textContent ) . not . toMatch ( / \* / g) ;
368
+ expect ( labelEl . nativeElement . textContent ) . toBe ( 'Other placeholder' ) ;
370
369
} ) ) ;
371
370
372
371
it ( 'supports placeholder element' , fakeAsync ( ( ) => {
@@ -382,8 +381,7 @@ describe('MatInput without forms', () => {
382
381
383
382
el = fixture . debugElement . query ( By . css ( 'label' ) ) ;
384
383
expect ( el ) . not . toBeNull ( ) ;
385
- expect ( el . nativeElement . textContent ) . toMatch ( 'Other placeholder' ) ;
386
- expect ( el . nativeElement . textContent ) . not . toMatch ( / \* / g) ;
384
+ expect ( el . nativeElement . textContent ) . toBe ( 'Other placeholder' ) ;
387
385
} ) ) ;
388
386
389
387
it ( 'supports placeholder required star' , fakeAsync ( ( ) => {
@@ -392,7 +390,8 @@ describe('MatInput without forms', () => {
392
390
393
391
let el = fixture . debugElement . query ( By . css ( 'label' ) ) ;
394
392
expect ( el ) . not . toBeNull ( ) ;
395
- expect ( el . nativeElement . textContent ) . toMatch ( / h e l l o \s + \* / g) ;
393
+ // The \xa0 hex-code represents the no-break space ( )
394
+ expect ( el . nativeElement . textContent ) . toBe ( 'hello\xa0*' ) ;
396
395
} ) ) ;
397
396
398
397
it ( 'should hide the required star if input is disabled' , ( ) => {
@@ -404,7 +403,7 @@ describe('MatInput without forms', () => {
404
403
const el = fixture . debugElement . query ( By . css ( 'label' ) ) ;
405
404
406
405
expect ( el ) . not . toBeNull ( ) ;
407
- expect ( el . nativeElement . textContent ! . trim ( ) ) . toMatch ( / ^ h e l l o $ / ) ;
406
+ expect ( el . nativeElement . textContent ) . toBe ( ' hello' ) ;
408
407
} ) ;
409
408
410
409
it ( 'should hide the required star from screen readers' , fakeAsync ( ( ) => {
@@ -422,12 +421,13 @@ describe('MatInput without forms', () => {
422
421
423
422
let el = fixture . debugElement . query ( By . css ( 'label' ) ) ;
424
423
expect ( el ) . not . toBeNull ( ) ;
425
- expect ( el . nativeElement . textContent ) . toMatch ( / h e l l o \s + \* / g) ;
424
+ // The \xa0 hex-code represents the no-break space ( )
425
+ expect ( el . nativeElement . textContent ) . toBe ( 'hello\xa0*' ) ;
426
426
427
427
fixture . componentInstance . hideRequiredMarker = true ;
428
428
fixture . detectChanges ( ) ;
429
429
430
- expect ( el . nativeElement . textContent ) . toMatch ( / h e l l o / g ) ;
430
+ expect ( el . nativeElement . textContent ) . toBe ( ' hello' ) ;
431
431
} ) ) ;
432
432
433
433
it ( 'supports the disabled attribute as binding' , fakeAsync ( ( ) => {
@@ -841,7 +841,7 @@ describe('MatInput without forms', () => {
841
841
842
842
expect ( container . classList ) . toContain ( 'mat-form-field-hide-placeholder' ) ;
843
843
expect ( container . classList ) . not . toContain ( 'mat-form-field-should-float' ) ;
844
- expect ( label . textContent . trim ( ) ) . toBe ( 'Label' ) ;
844
+ expect ( label . textContent ) . toBe ( 'Label' ) ;
845
845
expect ( input . getAttribute ( 'placeholder' ) ) . toBe ( 'Placeholder' ) ;
846
846
847
847
input . value = 'Value' ;
0 commit comments