Skip to content

Commit eeccc3f

Browse files
Merge pull request #2 from jwala-anirudh/angular-v9
Angular v9
2 parents 0bcfab8 + a34f31c commit eeccc3f

36 files changed

+193
-193
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Angular2 Cookie Law
1+
# Angular2 Cookie Banner
22

3-
> Angular2+ component that provides a banner to inform users about the cookie law now with Angular Universal support
3+
> Angular2+ component that provides a banner to inform users about the cookie banner now with Angular Universal support
44
5-
Angular2 Cookie Law is an HTML `<cookie-law>` tag enhanced with styling and animation.
5+
Angular2 Cookie banner is an HTML `<cookie-banner>` tag enhanced with styling and animation.

angular.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -107,32 +107,32 @@
107107
}
108108
}
109109
},
110-
"angular2-cookie-law": {
111-
"root": "projects/angular2-cookie-law",
112-
"sourceRoot": "projects/angular2-cookie-law/src",
110+
"angular2-cookie-law-banner": {
111+
"root": "projects/angular2-cookie-law-banner",
112+
"sourceRoot": "projects/angular2-cookie-law-banner/src",
113113
"projectType": "library",
114-
"prefix": "cookie-law",
114+
"prefix": "cookie-banner",
115115
"architect": {
116116
"build": {
117117
"builder": "@angular-devkit/build-ng-packagr:build",
118118
"options": {
119-
"tsConfig": "projects/angular2-cookie-law/tsconfig.lib.json",
120-
"project": "projects/angular2-cookie-law/ng-package.json"
119+
"tsConfig": "projects/angular2-cookie-law-banner/tsconfig.lib.json",
120+
"project": "projects/angular2-cookie-law-banner/ng-package.json"
121121
},
122122
"configurations": {
123123
"production": {
124-
"project": "projects/angular2-cookie-law/ng-package.prod.json",
125-
"tsConfig": "projects/angular2-cookie-law/tsconfig.lib.prod.json"
124+
"project": "projects/angular2-cookie-law-banner/ng-package.prod.json",
125+
"tsConfig": "projects/angular2-cookie-law-banner/tsconfig.lib.prod.json"
126126
}
127127
}
128128
},
129129
"test": {
130130
"builder": "@angular-devkit/build-angular:karma",
131131
"options": {
132132
"browsers": "Chrome",
133-
"main": "projects/angular2-cookie-law/src/test.ts",
134-
"tsConfig": "projects/angular2-cookie-law/tsconfig.spec.json",
135-
"karmaConfig": "projects/angular2-cookie-law/karma.conf.js"
133+
"main": "projects/angular2-cookie-law-banner/src/test.ts",
134+
"tsConfig": "projects/angular2-cookie-law-banner/tsconfig.spec.json",
135+
"karmaConfig": "projects/angular2-cookie-law-banner/karma.conf.js"
136136
},
137137
"configurations": {
138138
"headless": {
@@ -145,8 +145,8 @@
145145
"builder": "@angular-devkit/build-angular:tslint",
146146
"options": {
147147
"tsConfig": [
148-
"projects/angular2-cookie-law/tsconfig.lib.json",
149-
"projects/angular2-cookie-law/tsconfig.spec.json"
148+
"projects/angular2-cookie-law-banner/tsconfig.lib.json",
149+
"projects/angular2-cookie-law-banner/tsconfig.spec.json"
150150
],
151151
"exclude": ["**/node_modules/**"]
152152
}

e2e/src/app.e2e-spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { AppPage } from './app.po';
1+
import { AppPage } from "./app.po";
22

3-
describe('workspace-project App', () => {
3+
describe("workspace-project App", () => {
44
let page: AppPage;
55

66
beforeEach(() => {
77
page = new AppPage();
88
});
99

10-
it('should display welcome message', () => {
10+
it("should display welcome message", () => {
1111
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('Angular2CookieLaw');
12+
expect(page.getParagraphText()).toEqual("Angular2CookieLawBanner");
1313
});
1414
});

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "angular2-cookie-law",
3-
"version": "0.0.0-development",
4-
"description": "Angular2+ component that provides a banner to inform users about cookie law",
2+
"name": "angular2-cookie-law-banner",
3+
"version": "1.0.0",
4+
"description": "Angular2+ component that provides a banner to inform users about cookie banner",
55
"repository": {
66
"type": "git",
7-
"url": "https://github.com/jwala-anirudh/angular2-cookie-law.git"
7+
"url": "https://github.com/jwala-anirudh/angular2-cookie-law-banner.git"
88
},
99
"keywords": [
1010
"ng",
@@ -18,23 +18,23 @@
1818
"angular2-component",
1919
"angular7-component",
2020
"cookie",
21-
"cookie-law"
21+
"cookie-banner"
2222
],
2323
"author": "Anirudh Jwala <[email protected]> (https://github.com/jwala-anirudh)",
2424
"license": "MIT",
2525
"bugs": {
26-
"url": "https://github.com/jwala-anirudh/angular2-cookie-law/issues"
26+
"url": "https://github.com/jwala-anirudh/angular2-cookie-law-banner/issues"
2727
},
28-
"homepage": "https://github.com/jwala-anirudh/angular2-cookie-law#readme",
28+
"homepage": "https://github.com/jwala-anirudh/angular2-cookie-law-banner#readme",
2929
"scripts": {
3030
"ng": "ng",
3131
"start": "ng serve",
3232
"build": "ng build",
33-
"build:prod": "ng build angular2-cookie-law --prod",
33+
"build:prod": "ng build angular2-cookie-law-banner --prod",
3434
"commit": "git-cz",
35-
"semantic-release": "cd dist/angular2-cookie-law && semantic-release",
36-
"test": "ng test angular2-cookie-law",
37-
"test:headless": "ng test angular2-cookie-law -c headless",
35+
"semantic-release": "cd dist/angular2-cookie-law-banner && semantic-release",
36+
"test": "ng test angular2-cookie-law-banner",
37+
"test:headless": "ng test angular2-cookie-law-banner -c headless",
3838
"lint": "ng lint",
3939
"e2e": "ng e2e"
4040
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Angular2 Cookie Banner
2+
3+
> Angular2+ component that provides a banner to inform users about the cookie banner now with Angular Universal support
4+
5+
Angular2 Cookie Banner is an HTML `<cookie-banner>` tag enhanced with styling and animation.

projects/angular2-cookie-law/ng-package.json projects/angular2-cookie-law-banner/ng-package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3-
"dest": "../../dist/angular2-cookie-law",
3+
"dest": "../../dist/angular2-cookie-law-banner",
44
"deleteDestPath": false,
55
"lib": {
66
"entryFile": "src/public_api.ts"

projects/angular2-cookie-law/ng-package.prod.json projects/angular2-cookie-law-banner/ng-package.prod.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3-
"dest": "../../dist/angular2-cookie-law",
3+
"dest": "../../dist/angular2-cookie-law-banner",
44
"lib": {
55
"entryFile": "src/public_api.ts"
66
}

projects/angular2-cookie-law/package.json projects/angular2-cookie-law-banner/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "angular2-cookie-law",
3-
"description": "Angular2+ component that provides a banner to inform users about cookie law",
2+
"name": "angular2-cookie-law-banner",
3+
"description": "Angular2+ component that provides a banner to inform users about cookie banner",
44
"repository": {
55
"type": "git",
6-
"url": "https://github.com/jwala-anirudh/angular2-cookie-law.git"
6+
"url": "https://github.com/jwala-anirudh/angular2-cookie-law-banner.git"
77
},
88
"keywords": [
99
"ng",
@@ -17,14 +17,14 @@
1717
"angular2-component",
1818
"angular7-component",
1919
"cookie",
20-
"cookie-law"
20+
"cookie-banner"
2121
],
2222
"author": "Anirudh Jwala <[email protected]> (https://github.com/jwala-anirudh)",
2323
"license": "MIT",
2424
"bugs": {
25-
"url": "https://github.com/jwala-anirudh/angular2-cookie-law/issues"
25+
"url": "https://github.com/jwala-anirudh/angular2-cookie-law-banner/issues"
2626
},
27-
"homepage": "https://github.com/jwala-anirudh/angular2-cookie-law#readme",
27+
"homepage": "https://github.com/jwala-anirudh/angular2-cookie-law-banner#readme",
2828
"version": "1.0.0",
2929
"peerDependencies": {
3030
"@angular/common": "^9.0.0",

projects/angular2-cookie-law/src/lib/angular2-cookie-law-container.component.spec.ts projects/angular2-cookie-law-banner/src/lib/angular2-cookie-law-banner-container.component.spec.ts

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
22

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";
66
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
77
import { DebugElement } from "@angular/core";
88
import { By } from "@angular/platform-browser";
99

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>;
1414

15-
// stub CookieLawService for test purposes
16-
const CookieLawServiceStub = {
15+
// stub CookieBannerService for test purposes
16+
const CookieBannerServiceStub = {
1717
_seen: false,
1818

1919
seen() {
@@ -28,20 +28,20 @@ describe("CookieLawContainerComponent", () => {
2828
beforeEach(async(() => {
2929
TestBed.configureTestingModule({
3030
imports: [NoopAnimationsModule],
31-
declarations: [CookieLawContainerComponent, CookieLawComponent],
31+
declarations: [CookieBannerContainerComponent, CookieBannerComponent],
3232
providers: [
3333
{
34-
provide: Angular2CookieLawService,
35-
useValue: CookieLawServiceStub,
34+
provide: Angular2CookieLawBannerService,
35+
useValue: CookieBannerServiceStub,
3636
},
3737
],
3838
}).compileComponents();
3939

40-
cookiesPolicyService = TestBed.inject(Angular2CookieLawService);
40+
cookiesPolicyService = TestBed.inject(Angular2CookieLawBannerService);
4141
}));
4242

4343
beforeEach(() => {
44-
fixture = TestBed.createComponent(CookieLawContainerComponent);
44+
fixture = TestBed.createComponent(CookieBannerContainerComponent);
4545
component = fixture.componentInstance;
4646
fixture.detectChanges();
4747
});
@@ -62,22 +62,22 @@ describe("CookieLawContainerComponent", () => {
6262
);
6363
});
6464

65-
it("CookieLawComponent should have a `seen` attribute", () => {
65+
it("CookieBannerComponent should have a `seen` attribute", () => {
6666
const element: HTMLElement = fixture.debugElement.nativeElement;
6767

6868
fixture.detectChanges();
6969

7070
expect(element.getAttribute("seen")).toBe("false");
7171
});
7272

73-
it("CookieLawComponent should be initially visible", () => {
73+
it("CookieBannerComponent should be initially visible", () => {
7474
fixture.detectChanges();
7575

7676
expect(component.seen).toBe(false);
7777
expect(component.cookieLawSeen).toBe(false);
7878
});
7979

80-
it("CookieLawComponent should be dismissible", () => {
80+
it("CookieBannerComponent should be dismissible", () => {
8181
fixture.detectChanges();
8282

8383
expect(component.seen).toBe(false);
@@ -89,11 +89,11 @@ describe("CookieLawContainerComponent", () => {
8989
expect(component.cookieLawSeen).toBe(true);
9090
});
9191

92-
it("CookieLawElementComponent should accept attributes", () => {
92+
it("CookieBannerElementComponent should accept attributes", () => {
9393
fixture.detectChanges();
9494

9595
const el: DebugElement = fixture.debugElement.query(
96-
By.css("cookie-law-component")
96+
By.css("cookie-banner-component")
9797
);
9898

9999
expect(fixture.nativeElement.getAttribute("seen")).toBe("false");
@@ -108,28 +108,28 @@ describe("CookieLawContainerComponent", () => {
108108
expect(el.componentInstance.transition).toBe("bottomIn");
109109
});
110110

111-
it("CookieLawElementComponent should renders on the top", () => {
111+
it("CookieBannerElementComponent should renders on the top", () => {
112112
component.name = "myCookie";
113113
component.position = "top";
114114

115115
fixture.detectChanges();
116116

117117
const el: DebugElement = fixture.debugElement.query(
118-
By.css("cookie-law-component")
118+
By.css("cookie-banner-component")
119119
);
120120

121121
expect(component.position).toBe("top");
122122
expect(el.componentInstance.position).toBe("top");
123123
});
124124

125-
it("CookieLawElementComponent learnMore", () => {
125+
it("CookieBannerElementComponent learnMore", () => {
126126
component.learnMore = "/#cookies";
127127
component.target = "_self";
128128

129129
fixture.detectChanges();
130130

131131
const el: DebugElement = fixture.debugElement.query(
132-
By.css("cookie-law-component")
132+
By.css("cookie-banner-component")
133133
);
134134

135135
expect(el.componentInstance.target).toBe("_self");

projects/angular2-cookie-law/src/lib/angular2-cookie-law-container.component.ts projects/angular2-cookie-law-banner/src/lib/angular2-cookie-law-banner-container.component.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* angular2-cookie-law
2+
* angular2-cookie-law-banner
33
*
44
* Copyright 2016-2018, @jwala-anirudh, All rights reserved.
55
*
@@ -16,14 +16,14 @@ import {
1616
EventEmitter,
1717
} from "@angular/core";
1818

19-
import { Angular2CookieLawService } from "./angular2-cookie-law.service";
20-
import { CookieLawComponent } from "./angular2-cookie-law.component";
21-
import { CookieLawTarget, CookieLawPosition } from "./definitions";
19+
import { Angular2CookieLawBannerService } from "./angular2-cookie-law-banner.service";
20+
import { CookieBannerComponent } from "./angular2-cookie-law-banner.component";
21+
import { CookieBannerTarget, CookieBannerPosition } from "./definitions";
2222

2323
@Component({
24-
selector: "cookie-law",
24+
selector: "cookie-banner",
2525
template: `
26-
<cookie-law-component
26+
<cookie-banner-component
2727
*ngIf="!seen"
2828
[awsomeCloseIcon]="awsomeCloseIcon"
2929
[learnMore]="learnMore"
@@ -32,15 +32,15 @@ import { CookieLawTarget, CookieLawPosition } from "./definitions";
3232
(isSeen)="hasBeenDismissed()"
3333
>
3434
<ng-content></ng-content>
35-
</cookie-law-component>
35+
</cookie-banner-component>
3636
`,
3737
})
38-
export class CookieLawContainerComponent implements OnInit {
38+
export class CookieBannerContainerComponent implements OnInit {
3939
@HostBinding("attr.seen")
4040
public seen: boolean;
4141

42-
@ViewChild(CookieLawComponent)
43-
public cookieLawComponent: CookieLawComponent;
42+
@ViewChild(CookieBannerComponent)
43+
public cookieLawComponent: CookieBannerComponent;
4444

4545
@Input()
4646
public name: string;
@@ -49,10 +49,10 @@ export class CookieLawContainerComponent implements OnInit {
4949
public learnMore: string;
5050

5151
@Input()
52-
public target: CookieLawTarget;
52+
public target: CookieBannerTarget;
5353

5454
@Input()
55-
public position: CookieLawPosition;
55+
public position: CookieBannerPosition;
5656

5757
@Input()
5858
public expiration: number;
@@ -67,7 +67,7 @@ export class CookieLawContainerComponent implements OnInit {
6767
return this.cookieLawService.seen(this.name);
6868
}
6969

70-
constructor(private cookieLawService: Angular2CookieLawService) {
70+
constructor(private cookieLawService: Angular2CookieLawBannerService) {
7171
this.name = "cookieLawSeen"; // set a default cookie name if not provided
7272
this.seen = true;
7373
}

0 commit comments

Comments
 (0)