Skip to content

Commit dce9fc8

Browse files
YomesInctocker
authored andcommitted
Add tests of initialWidth and initialHeight params
1 parent 971798b commit dce9fc8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cloudinary-image.component.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ describe('CloudinaryImage', () => {
102102
<cl-transformation width="300" crop="scale" overlay="text:roboto_35_bold:SDK"></cl-transformation>
103103
<cl-transformation effect="art:hokusai"></cl-transformation>
104104
<cl-transformation fetch-format="auto"></cl-transformation>
105+
<cl-transformation if="initialWidth > 400" effect="grayscale"></cl-transformation>
106+
<cl-transformation if="initialHeight < 200" effect="blur"></cl-transformation>
105107
</cl-image>`
106108
})
107109
class TestComponent { }
@@ -124,7 +126,7 @@ describe('CloudinaryImage', () => {
124126
it('creates an img element which encodes the directive attributes to the URL', () => {
125127
const img = des.children[0].nativeElement as HTMLImageElement;
126128
expect(img.src).toEqual(jasmine.stringMatching
127-
(/c_scale,l_text:roboto_35_bold:SDK,w_300\/e_art:hokusai\/f_auto\/responsive_sample.jpg/));
129+
(/c_scale,l_text:roboto_35_bold:SDK,w_300\/e_art:hokusai\/f_auto\/if_iw_gt_400,e_grayscale\/if_ih_lt_200,e_blur\/responsive_sample.jpg/));
128130
expect(img.attributes.getNamedItem('data-src')).toBeNull();
129131
});
130132

@@ -135,7 +137,7 @@ describe('CloudinaryImage', () => {
135137
const observer = new MutationObserver(() => {
136138
const img = des.children[0].nativeElement as HTMLImageElement;
137139
expect(img.src).toEqual(jasmine.stringMatching
138-
(/c_scale,l_text:roboto_35_bold:SDK,w_300\/e_art:hokusai\/f_auto\/o_50\/responsive_sample.jpg/));
140+
(/c_scale,l_text:roboto_35_bold:SDK,w_300\/e_art:hokusai\/f_auto\/if_iw_gt_400,e_grayscale\/if_ih_lt_200,e_blur\/o_50\/responsive_sample.jpg/));
139141
observer.disconnect();
140142
done();
141143
});

0 commit comments

Comments
 (0)