@@ -2,7 +2,6 @@ import { ComponentRef } from '@angular/core';
22import { ComponentFixture , TestBed , waitForAsync } from '@angular/core/testing' ;
33import { provideRouter , Route } from '@angular/router' ;
44import { RouterTestingHarness } from '@angular/router/testing' ;
5- import { take } from 'rxjs' ;
65
76import { BreadcrumbRouterComponent } from './breadcrumb-router.component' ;
87import { BreadcrumbRouterService } from './breadcrumb-router.service' ;
@@ -40,33 +39,25 @@ describe('BreadcrumbComponent', () => {
4039 } ) ;
4140
4241 it ( 'should have breadcrumbs' , ( ) => {
43- expect ( component . breadcrumbs ) . toBeDefined ( ) ;
42+ expect ( component . breadcrumbs ( ) ) . toBeDefined ( ) ;
4443 } ) ;
4544
4645 it ( 'should get breadcrumbs from service' , async ( ) => {
4746 const comp = await harness . navigateByUrl ( '/home' ) ;
48- component . breadcrumbs ?. pipe ( take ( 1 ) ) . subscribe ( ( breadcrumbs ) => {
49- expect ( breadcrumbs ) . toEqual ( [ { label : 'Home' , url : '/home' , queryParams : { } } ] ) ;
50- } ) ;
47+ expect ( component . breadcrumbs ( ) ) . toEqual ( [ { label : 'Home' , url : '/home' , queryParams : { } } ] ) ;
5148 } ) ;
5249 it ( 'should get breadcrumbs from service' , async ( ) => {
5350 const comp = await harness . navigateByUrl ( '/color?id=1&test=2' ) ;
54- component . breadcrumbs ?. pipe ( take ( 1 ) ) . subscribe ( ( breadcrumbs ) => {
55- expect ( breadcrumbs ) . toEqual ( [ { label : 'Color' , url : '/color' , queryParams : { id : '1' , test : '2' } } ] ) ;
56- } ) ;
51+ expect ( component . breadcrumbs ( ) ) . toEqual ( [ { label : 'Color' , url : '/color' , queryParams : { id : '1' , test : '2' } } ] ) ;
5752 } ) ;
5853 it ( 'should get breadcrumbs from service' , async ( ) => {
5954 const comp = await harness . navigateByUrl ( '/' ) ;
60- component . breadcrumbs ?. pipe ( take ( 1 ) ) . subscribe ( ( breadcrumbs ) => {
61- expect ( breadcrumbs ) . toEqual ( [ { label : '' , url : '/' , queryParams : { } } ] ) ;
62- } ) ;
55+ expect ( component . breadcrumbs ( ) ) . toEqual ( [ { label : '' , url : '/' , queryParams : { } } ] ) ;
6356 } ) ;
6457
6558 it ( 'should emit breadcrumbs on items change' , ( ) => {
66- componentRef . setInput ( 'items' , [ { label : 'test' } ] ) ;
59+ componentRef . setInput ( 'items' , [ { label : 'test' , url : '/color' , attributes : { title : 'test' } } ] ) ;
6760 fixture . detectChanges ( ) ;
68- component . breadcrumbs ?. pipe ( take ( 1 ) ) . subscribe ( ( breadcrumbs ) => {
69- expect ( breadcrumbs ) . toEqual ( [ { label : 'test' } ] ) ;
70- } ) ;
61+ expect ( component . breadcrumbs ( ) ) . toEqual ( [ { label : 'test' , url : '/color' , attributes : { title : 'test' } } ] ) ;
7162 } ) ;
7263} ) ;
0 commit comments