Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion projects/angular-cld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
33 changes: 33 additions & 0 deletions projects/angular-cld/src/lib/cloudinary-image.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,39 @@ describe('CloudinaryImage', () => {
});
});

describe('should support user variables with keyword $width', () => {
@Component({
template:
`
<cl-image public-id="sample">
<cl-transformation variables="[['$width','150']]"></cl-transformation>
<cl-transformation width="$width" crop="crop" ></cl-transformation>
</cl-image>
`
})
class TestComponent { }

let fixture: ComponentFixture<TestComponent>;
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:
Expand Down