Skip to content

Commit

Permalink
Merge pull request #7 from apalumbo/master
Browse files Browse the repository at this point in the history
'auto' support in fetch and fetchFormat
  • Loading branch information
marnusw authored May 15, 2021
2 parents 584de96 + 7b3894f commit e9b3d98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/cloudinary.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ describe('cloudinary configuration', () => {
)
})

it('fetchFormat auto is supported in defaults', () => {
const cl = cloudinary({
cloudName: 'demo',
imageTransformDefaults: { width: 200, crop: 'fill', quality: 'auto', fetchFormat: 'auto' },
})
expect(cl('something')).toBe(
'https://res.cloudinary.com/demo/image/upload/w_200,c_fill,q_auto,f_auto/something',
)
})

it('merges a single transform with the defaults, and unsets a default when undefined is passed', () => {
const cl = cloudinary({
cloudName: 'demo',
Expand Down
4 changes: 2 additions & 2 deletions src/transforms/imageTransformTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ export interface ImageTransform {
density?: number | string
dpr?: number | string
effect?: string
fetchFormat?: ImageFileExtension
format?: ImageFileExtension
fetchFormat?: ImageFileExtension | 'auto'
format?: ImageFileExtension | 'auto'
flags?: ImageFlags | string
gravity?: Gravity
height?: number | string
Expand Down

0 comments on commit e9b3d98

Please sign in to comment.