1
1
import { async , ComponentFixture , TestBed } from "@angular/core/testing" ;
2
2
3
- import { CookieLawContainerComponent } from "./angular2-cookie-law-container.component" ;
4
- import { Angular2CookieLawService } from "./angular2-cookie-law.service" ;
5
- import { CookieLawComponent } from "./angular2-cookie-law.component" ;
3
+ import { CookieBannerContainerComponent } from "./angular2-cookie-law-banner -container.component" ;
4
+ import { Angular2CookieLawBannerService } from "./angular2-cookie-law-banner .service" ;
5
+ import { CookieBannerComponent } from "./angular2-cookie-law-banner .component" ;
6
6
import { NoopAnimationsModule } from "@angular/platform-browser/animations" ;
7
7
import { DebugElement } from "@angular/core" ;
8
8
import { By } from "@angular/platform-browser" ;
9
9
10
- describe ( "CookieLawContainerComponent " , ( ) => {
11
- let component : CookieLawContainerComponent ;
12
- let cookiesPolicyService : Angular2CookieLawService ;
13
- let fixture : ComponentFixture < CookieLawContainerComponent > ;
10
+ describe ( "CookieBannerContainerComponent " , ( ) => {
11
+ let component : CookieBannerContainerComponent ;
12
+ let cookiesPolicyService : Angular2CookieLawBannerService ;
13
+ let fixture : ComponentFixture < CookieBannerContainerComponent > ;
14
14
15
- // stub CookieLawService for test purposes
16
- const CookieLawServiceStub = {
15
+ // stub CookieBannerService for test purposes
16
+ const CookieBannerServiceStub = {
17
17
_seen : false ,
18
18
19
19
seen ( ) {
@@ -28,20 +28,20 @@ describe("CookieLawContainerComponent", () => {
28
28
beforeEach ( async ( ( ) => {
29
29
TestBed . configureTestingModule ( {
30
30
imports : [ NoopAnimationsModule ] ,
31
- declarations : [ CookieLawContainerComponent , CookieLawComponent ] ,
31
+ declarations : [ CookieBannerContainerComponent , CookieBannerComponent ] ,
32
32
providers : [
33
33
{
34
- provide : Angular2CookieLawService ,
35
- useValue : CookieLawServiceStub ,
34
+ provide : Angular2CookieLawBannerService ,
35
+ useValue : CookieBannerServiceStub ,
36
36
} ,
37
37
] ,
38
38
} ) . compileComponents ( ) ;
39
39
40
- cookiesPolicyService = TestBed . inject ( Angular2CookieLawService ) ;
40
+ cookiesPolicyService = TestBed . inject ( Angular2CookieLawBannerService ) ;
41
41
} ) ) ;
42
42
43
43
beforeEach ( ( ) => {
44
- fixture = TestBed . createComponent ( CookieLawContainerComponent ) ;
44
+ fixture = TestBed . createComponent ( CookieBannerContainerComponent ) ;
45
45
component = fixture . componentInstance ;
46
46
fixture . detectChanges ( ) ;
47
47
} ) ;
@@ -62,22 +62,22 @@ describe("CookieLawContainerComponent", () => {
62
62
) ;
63
63
} ) ;
64
64
65
- it ( "CookieLawComponent should have a `seen` attribute" , ( ) => {
65
+ it ( "CookieBannerComponent should have a `seen` attribute" , ( ) => {
66
66
const element : HTMLElement = fixture . debugElement . nativeElement ;
67
67
68
68
fixture . detectChanges ( ) ;
69
69
70
70
expect ( element . getAttribute ( "seen" ) ) . toBe ( "false" ) ;
71
71
} ) ;
72
72
73
- it ( "CookieLawComponent should be initially visible" , ( ) => {
73
+ it ( "CookieBannerComponent should be initially visible" , ( ) => {
74
74
fixture . detectChanges ( ) ;
75
75
76
76
expect ( component . seen ) . toBe ( false ) ;
77
77
expect ( component . cookieLawSeen ) . toBe ( false ) ;
78
78
} ) ;
79
79
80
- it ( "CookieLawComponent should be dismissible" , ( ) => {
80
+ it ( "CookieBannerComponent should be dismissible" , ( ) => {
81
81
fixture . detectChanges ( ) ;
82
82
83
83
expect ( component . seen ) . toBe ( false ) ;
@@ -89,11 +89,11 @@ describe("CookieLawContainerComponent", () => {
89
89
expect ( component . cookieLawSeen ) . toBe ( true ) ;
90
90
} ) ;
91
91
92
- it ( "CookieLawElementComponent should accept attributes" , ( ) => {
92
+ it ( "CookieBannerElementComponent should accept attributes" , ( ) => {
93
93
fixture . detectChanges ( ) ;
94
94
95
95
const el : DebugElement = fixture . debugElement . query (
96
- By . css ( "cookie-law -component" )
96
+ By . css ( "cookie-banner -component" )
97
97
) ;
98
98
99
99
expect ( fixture . nativeElement . getAttribute ( "seen" ) ) . toBe ( "false" ) ;
@@ -108,28 +108,28 @@ describe("CookieLawContainerComponent", () => {
108
108
expect ( el . componentInstance . transition ) . toBe ( "bottomIn" ) ;
109
109
} ) ;
110
110
111
- it ( "CookieLawElementComponent should renders on the top" , ( ) => {
111
+ it ( "CookieBannerElementComponent should renders on the top" , ( ) => {
112
112
component . name = "myCookie" ;
113
113
component . position = "top" ;
114
114
115
115
fixture . detectChanges ( ) ;
116
116
117
117
const el : DebugElement = fixture . debugElement . query (
118
- By . css ( "cookie-law -component" )
118
+ By . css ( "cookie-banner -component" )
119
119
) ;
120
120
121
121
expect ( component . position ) . toBe ( "top" ) ;
122
122
expect ( el . componentInstance . position ) . toBe ( "top" ) ;
123
123
} ) ;
124
124
125
- it ( "CookieLawElementComponent learnMore" , ( ) => {
125
+ it ( "CookieBannerElementComponent learnMore" , ( ) => {
126
126
component . learnMore = "/#cookies" ;
127
127
component . target = "_self" ;
128
128
129
129
fixture . detectChanges ( ) ;
130
130
131
131
const el : DebugElement = fixture . debugElement . query (
132
- By . css ( "cookie-law -component" )
132
+ By . css ( "cookie-banner -component" )
133
133
) ;
134
134
135
135
expect ( el . componentInstance . target ) . toBe ( "_self" ) ;
0 commit comments