@@ -2,7 +2,6 @@ import { ComponentRef } from '@angular/core';
2
2
import { ComponentFixture , TestBed , waitForAsync } from '@angular/core/testing' ;
3
3
import { provideRouter , Route } from '@angular/router' ;
4
4
import { RouterTestingHarness } from '@angular/router/testing' ;
5
- import { take } from 'rxjs' ;
6
5
7
6
import { BreadcrumbRouterComponent } from './breadcrumb-router.component' ;
8
7
import { BreadcrumbRouterService } from './breadcrumb-router.service' ;
@@ -40,33 +39,25 @@ describe('BreadcrumbComponent', () => {
40
39
} ) ;
41
40
42
41
it ( 'should have breadcrumbs' , ( ) => {
43
- expect ( component . breadcrumbs ) . toBeDefined ( ) ;
42
+ expect ( component . breadcrumbs ( ) ) . toBeDefined ( ) ;
44
43
} ) ;
45
44
46
45
it ( 'should get breadcrumbs from service' , async ( ) => {
47
46
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 : { } } ] ) ;
51
48
} ) ;
52
49
it ( 'should get breadcrumbs from service' , async ( ) => {
53
50
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' } } ] ) ;
57
52
} ) ;
58
53
it ( 'should get breadcrumbs from service' , async ( ) => {
59
54
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 : { } } ] ) ;
63
56
} ) ;
64
57
65
58
it ( 'should emit breadcrumbs on items change' , ( ) => {
66
- componentRef . setInput ( 'items' , [ { label : 'test' } ] ) ;
59
+ componentRef . setInput ( 'items' , [ { label : 'test' , url : '/color' , attributes : { title : 'test' } } ] ) ;
67
60
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' } } ] ) ;
71
62
} ) ;
72
63
} ) ;
0 commit comments