Skip to content

Commit 9d1aeb9

Browse files
authored
updated readme with angular 11 (#304)
1 parent 2c91b13 commit 9d1aeb9

File tree

5 files changed

+59
-25
lines changed

5 files changed

+59
-25
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
dist: trusty
22
sudo: required
33
language: node_js
4-
node_js:
5-
- "node"
4+
node_js: "14"
65
os:
76
- linux
87
script:

README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Cloudinary
22
==========
33
The official [Cloudinary](https://cloudinary.com) SDK for Angular.
44

5-
Cloudinary's AngularJS (AKA Angular1) SDK can be found [here](https://github.com/cloudinary/cloudinary_angular/tree/angular-1.x)
5+
We maintain difference branches for different versions. Cloudinary's latest Angular SDK can be found [here](https://github.com/cloudinary/cloudinary_angular/tree/angular-5.x)
66

77
[Cloudinary](https://cloudinary.com) is a cloud service that offers a solution to a web application's entire image management pipeline.
88

@@ -14,15 +14,8 @@ Cloudinary offers comprehensive APIs and administration capabilities and is easy
1414
Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.
1515

1616
For Angular, Cloudinary provides an SDK for simplifying the integration even further.
17-
The SDK serves as a layer on top of one of Cloudinary's Javascript libraries:
17+
The SDK serves as a layer on top of one of [Cloudinary's Javascript library](https://github.com/cloudinary/cloudinary_js).
1818

19-
| Github Repository | Package name | Description |
20-
|-------------------|--------------|-------------|
21-
| [pkg-cloudinary-core](https://github.com/cloudinary/pkg-cloudinary-core) | cloudinary-core | Core Cloudinary Library. Use this if you do not intend to use jQuery |
22-
| [pkg-cloudinary-jquery](https://github.com/cloudinary/pkg-cloudinary-jquery) | cloudinary-jquery | Core Library + jQuery plugin |
23-
| [pkg-cloudinary-jquery-file-upload](https://github.com/cloudinary/pkg-cloudinary-jquery-file-upload) | cloudinary-jquery-file-upload | Core Library + jQuery plugin + Blueimp File Upload adapter |
24-
25-
<a href="https://cloudinary.com/signup" style="background-color:#ff7829; border:1px solid; color: white; border-color: black; padding: 8px; text-decoration: none; box-shadow: 1px 1px 3px #224488; width: 500px">Signup for free</a>
2619

2720
## Live examples ##################################################################
2821
Start experimenting right away with one of these live examples:
@@ -36,19 +29,14 @@ Install the SDK version that supports the Angular version you are using:
3629

3730
* For Angular 2, use `2.x`
3831
* For Angular 4, use `4.x`
39-
* For Angular 5-10, use `5.x`
32+
* For Angular 5-11, use `5.x`
4033

4134
For example:
4235

4336
```shell
44-
npm install @cloudinary/angular-5.x --save
37+
npm install @cloudinary/angular-5.x cloudinary-core --save
4538
```
4639

47-
## Setup ######################################################################
48-
49-
Follow the setup procedure described in the [Cloudinary jQuery plugin](https://github.com/cloudinary/cloudinary_js#setup) setup procedure.
50-
Refer to the sample projects in this repository for usage examples.
51-
5240
## Usage ######################################################################
5341

5442
The module provides three types of directives:
@@ -64,7 +52,7 @@ Further video manipulation and delivery capabilities see listed in [this referen
6452
Note that the attribute names in the docs are using snake_case, however this SDK supports both snake_case and kebab-case for attribute names,
6553
e.g. both `fetch_format: 'auto'` and `'fetch-format': 'auto'` are eventually translated to `f_auto`.
6654

67-
### Cloudinary module configuration ##################################
55+
### Cloudinary module configuration and setup ##################################
6856
This SDK is based on the Cloudinary JS module, however the two are decoupled, i.e. this module's `Cloudinary` is a configurable service
6957
to which you provide your choice of our JS module.
7058

projects/angular-cld/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "@cloudinary/angular-5.x",
33
"version": "1.3.4",
44
"peerDependencies": {
5-
"@angular/common": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0",
6-
"@angular/core": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0"
5+
"@angular/common": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0",
6+
"@angular/core": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0"
77
},
88
"devDependencies": {
99
"cloudinary-core": "^2.10.2",

projects/angular-cld/src/lib/cloudinary-sdk-analytics.spec.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { CloudinaryImage } from './cloudinary-image.component';
77
import { CloudinaryTransformationDirective } from './cloudinary-transformation.directive';
88
import {LazyLoadDirective } from './cloudinary-lazy-load.directive';
99
import { CloudinaryPlaceHolder } from'./cloudinary-placeholder.component';
10+
import { SDKAnalyticsConstants } from './SDKAnalyticsConstants';
11+
import { APP_VERSION } from './version';
12+
1013

1114
describe('Tests for sdk versionID on image tag', () => {
1215
describe('Config with urlAnalytics not set', () => {
@@ -17,6 +20,7 @@ describe('Tests for sdk versionID on image tag', () => {
1720
spyOn(localCloudinary, 'toCloudinaryAttributes').and.callThrough();
1821
spyOn(localCloudinary, 'url').and.callThrough();
1922
spyOn(localCloudinary, 'responsive').and.callThrough();
23+
2024
});
2125
@Component({
2226
template: `<cl-image responsive public-id="sample"></cl-image>`
@@ -50,9 +54,15 @@ describe('Tests for sdk versionID on image tag', () => {
5054
{ cloud_name: '@@fake_angular_sdk@@', urlAnalytics: true} as CloudinaryConfiguration);
5155

5256
beforeEach(() => {
57+
SDKAnalyticsConstants.sdkSemver = '1.3.3';
5358
spyOn(localCloudinary, 'toCloudinaryAttributes').and.callThrough();
5459
spyOn(localCloudinary, 'url').and.callThrough();
5560
});
61+
62+
afterEach(() => {
63+
SDKAnalyticsConstants.sdkSemver = APP_VERSION;
64+
});
65+
5666
@Component({
5767
template: `<cl-image public-id="sample"></cl-image>`
5868
})
@@ -62,6 +72,7 @@ describe('Tests for sdk versionID on image tag', () => {
6272
let des: DebugElement; // the elements w/ the directive
6373

6474
beforeEach(() => {
75+
SDKAnalyticsConstants.sdkSemver = '1.3.3';
6576
fixture = TestBed.configureTestingModule({
6677
declarations: [CloudinaryImage, TestComponent],
6778
providers: [{ provide: Cloudinary, useValue: localCloudinary }]
@@ -73,6 +84,10 @@ describe('Tests for sdk versionID on image tag', () => {
7384
des = fixture.debugElement.query(By.directive(CloudinaryImage));
7485
});
7586

87+
afterEach(() => {
88+
SDKAnalyticsConstants.sdkSemver = APP_VERSION;
89+
});
90+
7691
it('creates an img without a feature- resulting in 0', () => {
7792
const img = des.children[0].nativeElement as HTMLImageElement;
7893
expect(img.attributes.getNamedItem('src').value).toEqual('http://res.cloudinary.com/@@fake_angular_sdk@@/image/upload/sample?_a=AKHZdAH0');
@@ -84,9 +99,16 @@ describe('Tests for sdk versionID on image tag', () => {
8499
{ cloud_name: '@@fake_angular_sdk@@', urlAnalytics: true} as CloudinaryConfiguration);
85100

86101
beforeEach(() => {
102+
SDKAnalyticsConstants.sdkSemver = '1.3.3';
87103
spyOn(localCloudinary, 'toCloudinaryAttributes').and.callThrough();
88104
spyOn(localCloudinary, 'url').and.callThrough();
105+
spyOn(SDKAnalyticsConstants, 'sdkSemver').and.returnValue('1.3.3');
89106
});
107+
108+
afterEach(() => {
109+
SDKAnalyticsConstants.sdkSemver = APP_VERSION;
110+
});
111+
90112
@Component({
91113
template: `<cl-image accessibility="darkmode" public-id="sample"></cl-image>`
92114
})
@@ -96,6 +118,7 @@ describe('Tests for sdk versionID on image tag', () => {
96118
let des: DebugElement; // the elements w/ the directive
97119

98120
beforeEach(() => {
121+
SDKAnalyticsConstants.sdkSemver = '1.3.3';
99122
fixture = TestBed.configureTestingModule({
100123
declarations: [CloudinaryImage, TestComponent],
101124
providers: [{ provide: Cloudinary, useValue: localCloudinary }]
@@ -107,6 +130,10 @@ describe('Tests for sdk versionID on image tag', () => {
107130
des = fixture.debugElement.query(By.directive(CloudinaryImage));
108131
});
109132

133+
afterEach(() => {
134+
SDKAnalyticsConstants.sdkSemver = APP_VERSION;
135+
});
136+
110137
it('creates an img with feature accessibility D', () => {
111138
const img = des.children[0].nativeElement as HTMLImageElement;
112139
expect(img.attributes.getNamedItem('src').value).toEqual('http://res.cloudinary.com/@@fake_angular_sdk@@/image/upload/e_tint:75:black/sample?_a=AKHZdAHD');
@@ -118,10 +145,16 @@ describe('Tests for sdk versionID on image tag', () => {
118145
{ cloud_name: '@@fake_angular_sdk@@', urlAnalytics: true } as CloudinaryConfiguration);
119146

120147
beforeEach(() => {
148+
SDKAnalyticsConstants.sdkSemver = '1.3.3';
121149
spyOn(localCloudinary, 'toCloudinaryAttributes').and.callThrough();
122150
spyOn(localCloudinary, 'url').and.callThrough();
123151
spyOn(localCloudinary, 'responsive').and.callThrough();
124152
});
153+
154+
afterEach(() => {
155+
SDKAnalyticsConstants.sdkSemver = APP_VERSION;
156+
});
157+
125158
@Component({
126159
template: `<cl-image responsive public-id="sample"></cl-image>`
127160
})
@@ -131,6 +164,7 @@ describe('Tests for sdk versionID on image tag', () => {
131164
let des: DebugElement; // the elements w/ the directive
132165

133166
beforeEach(() => {
167+
SDKAnalyticsConstants.sdkSemver = '1.3.3';
134168
fixture = TestBed.configureTestingModule({
135169
declarations: [CloudinaryImage, TestComponent],
136170
providers: [{ provide: Cloudinary, useValue: localCloudinary }]
@@ -143,6 +177,10 @@ describe('Tests for sdk versionID on image tag', () => {
143177
des = fixture.debugElement.query(By.directive(CloudinaryImage));
144178
});
145179

180+
afterEach(() => {
181+
SDKAnalyticsConstants.sdkSemver = APP_VERSION;
182+
});
183+
146184
it('creates an img with feature responsive A', () => {
147185
const img = des.children[0].nativeElement as HTMLImageElement;
148186
expect(img.attributes.getNamedItem('src').value).toEqual('http://res.cloudinary.com/@@fake_angular_sdk@@/image/upload/sample?_a=AKHZdAHA');
@@ -162,6 +200,7 @@ describe('Tests for sdk versionID on image tag', () => {
162200
let testLocalCloudinary: Cloudinary = new Cloudinary(require('cloudinary-core'),
163201
{ cloud_name: '@@fake_angular_sdk@@', urlAnalytics: true } as CloudinaryConfiguration);
164202
beforeEach(fakeAsync(() => {
203+
SDKAnalyticsConstants.sdkSemver = '1.3.3';
165204
fixture = TestBed.configureTestingModule({
166205
declarations: [CloudinaryTransformationDirective, CloudinaryImage, TestComponent, LazyLoadDirective, CloudinaryPlaceHolder],
167206
providers: [{ provide: Cloudinary, useValue: testLocalCloudinary }]
@@ -174,6 +213,9 @@ describe('Tests for sdk versionID on image tag', () => {
174213
tick();
175214
fixture.detectChanges();
176215
}));
216+
afterEach(() => {
217+
SDKAnalyticsConstants.sdkSemver = APP_VERSION;
218+
});
177219
it('placeholder img should encode with B', async () => {
178220
const placeholderimg = placeholder[0].children[0].nativeElement as HTMLImageElement;
179221
expect(placeholderimg.attributes.getNamedItem('src').value).toEqual('http://res.cloudinary.com/@@fake_angular_sdk@@/image/upload/e_blur:2000,f_auto,q_1/sample?_a=AKHZdAHB');
@@ -195,6 +237,7 @@ describe('Tests for sdk versionID on image tag', () => {
195237
let testLocalCloudinary: Cloudinary = new Cloudinary(require('cloudinary-core'),
196238
{ cloud_name: '@@fake_angular_sdk@@', urlAnalytics: true } as CloudinaryConfiguration);
197239
beforeEach(fakeAsync(() => {
240+
SDKAnalyticsConstants.sdkSemver = '1.3.3';
198241
fixture = TestBed.configureTestingModule({
199242
declarations: [CloudinaryTransformationDirective, CloudinaryImage, TestComponent, LazyLoadDirective, CloudinaryPlaceHolder],
200243
providers: [{ provide: Cloudinary, useValue: testLocalCloudinary }]
@@ -207,6 +250,9 @@ describe('Tests for sdk versionID on image tag', () => {
207250
tick();
208251
fixture.detectChanges();
209252
}));
253+
afterEach(() => {
254+
SDKAnalyticsConstants.sdkSemver = APP_VERSION;
255+
});
210256
it('creates an img with feature lazy load C', async () => {
211257
const wait = (ms) => new Promise(res => setTimeout(res, ms));
212258
await wait(300);

projects/angular-cld/src/lib/cloudinary.service.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('Cloudinary service', () => {
2323
});
2424

2525
it('updates the configuration', () => {
26-
26+
2727
const newConfig: CloudinaryConfiguration = {
2828
cloud_name: 'new-service-test'
2929
};
@@ -48,14 +48,15 @@ describe('Cloudinary service', () => {
4848
});
4949

5050
it('creates an image url', () => {
51-
const publicId = 'image_public_id.jpg';
52-
const options = {
51+
const publicId = 'image_public_id.jpg';
52+
53+
const options = {
5354
width: '100',
5455
crop: 'fill',
5556
responsive: true
5657
};
5758
expect(service.url(publicId, options)).toEqual(
58-
'http://res.cloudinary.com/service-test/image/upload/c_fill,w_100/image_public_id.jpg');
59+
'http://res.cloudinary.com/new-service-test/image/upload/c_fill,w_100/image_public_id.jpg');
5960
});
6061

6162
describe('isJsonLikeString', () => {

0 commit comments

Comments
 (0)