From 1834dbb7f7fb3875f4f9ccdef65d6b4a1a3cc199 Mon Sep 17 00:00:00 2001 From: Raya Straus Date: Sun, 21 Jun 2020 14:43:17 +0300 Subject: [PATCH] Added test for normarlized user variables --- package.json | 2 +- projects/angular-cld/package.json | 2 +- .../lib/cloudinary-image.component.spec.ts | 33 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 50f0f29d..5e221f9b 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@types/jasminewd2": "2.0.8", "@types/node": "^8.9.5", "bundlewatch": "0.2.6", - "cloudinary-core": "2.8.2", + "cloudinary-core": "2.9.0", "codelyzer": "4.2.1", "jasmine-core": "2.99.1", "jasmine-spec-reporter": "4.2.1", diff --git a/projects/angular-cld/package.json b/projects/angular-cld/package.json index 821a3ed5..3d96330b 100644 --- a/projects/angular-cld/package.json +++ b/projects/angular-cld/package.json @@ -6,7 +6,7 @@ "@angular/core": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" }, "devDependencies": { - "cloudinary-core": "^2.8.1", + "cloudinary-core": "^2.9.0", "typescript": "^2.9.2" } } diff --git a/projects/angular-cld/src/lib/cloudinary-image.component.spec.ts b/projects/angular-cld/src/lib/cloudinary-image.component.spec.ts index 3ac3a07c..8dbaf841 100644 --- a/projects/angular-cld/src/lib/cloudinary-image.component.spec.ts +++ b/projects/angular-cld/src/lib/cloudinary-image.component.spec.ts @@ -341,6 +341,39 @@ describe('CloudinaryImage', () => { }); }); + describe('should support user variables with keyword $width', () => { + @Component({ + template: + ` + + + + + ` + }) + class TestComponent { } + + let fixture: ComponentFixture; + let des: DebugElement; // the elements w/ the directive + + beforeEach(() => { + fixture = TestBed.configureTestingModule({ + declarations: [CloudinaryTransformationDirective, CloudinaryImage, TestComponent], + providers: [{ provide: Cloudinary, useValue: localCloudinary }] + }).createComponent(TestComponent); + + fixture.detectChanges(); // initial binding + + // Our element under test, which is attached to CloudinaryImage + des = fixture.debugElement.query(By.directive(CloudinaryImage)); + }); + + it('creates an img element with user variables $width', () => { + const img = des.children[0].nativeElement as HTMLImageElement; + expect(img.attributes.getNamedItem('src').value).toEqual('http://res.cloudinary.com/@@fake_angular2_sdk@@/image/upload/$width_150/c_crop,w_$width/sample'); + }); + }); + describe('Sample code presented in README', () => { @Component({ template: