Skip to content

Commit

Permalink
fixed possible value in resizing_type option (from fill_down to fill-…
Browse files Browse the repository at this point in the history
…down)
  • Loading branch information
Alqanar committed Mar 22, 2024
1 parent 8d61c99 commit 52392b9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/templates/ISSUE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ title: Usage docs of imgproxy have been updated
assignees: Alqanar
labels: enhancement
---

@{{ payload.client_payload.actor }} has just updated the [Usage](https://docs.imgproxy.net/category/usage) part of the documentation.
Please, check [the difference]({{ payload.client_payload.link }}) and make the necessary changes.
2 changes: 1 addition & 1 deletion src/options/resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const correctTypes = {
fit: true,
fill: true,
auto: true,
fill_down: true,
"fill-down": true,
force: true,
};

Expand Down
2 changes: 1 addition & 1 deletion src/options/resizingType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { guardIsUndef, guardIsValidVal } from "../utils";
const correctValues = {
fit: true,
fill: true,
fill_down: true,
"fill-down": true,
force: true,
auto: true,
};
Expand Down
2 changes: 1 addition & 1 deletion src/types/resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ResizingType } from "./resizingType";
*
* - `fit`: resizes the image while keeping aspect ratio to fit a given size. (**default value**)
* - `fill`: resizes the image while keeping aspect ratio to fill a given size and crops projecting parts.
* - `fill_down`: the same as fill, but if the resized image is smaller than the requested size,
* - `fill-down`: the same as fill, but if the resized image is smaller than the requested size,
* imgproxy will crop the result to keep the requested aspect ratio.
* - `force`: resizes the image without keeping the aspect ratio.
* - `auto`: if both source and resulting dimensions have the same orientation (portrait or landscape),
Expand Down
4 changes: 2 additions & 2 deletions src/types/resizingType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* `fill`: resizes the image while keeping aspect ratio to fill a given size and crops projecting parts.
*
* `fill_down`: the same as fill, but if the resized image is smaller than the requested size,
* `fill-down`: the same as fill, but if the resized image is smaller than the requested size,
* imgproxy will crop the result to keep the requested aspect ratio.
*
* `force`: resizes the image without keeping the aspect ratio.
Expand All @@ -19,7 +19,7 @@
*
* @see https://docs.imgproxy.net/generating_the_url?id=resizing-type
*/
type ResizingType = "fit" | "fill" | "fill_down" | "force" | "auto";
type ResizingType = "fit" | "fill" | "fill-down" | "force" | "auto";

/**
* *Resizing type option*
Expand Down
8 changes: 4 additions & 4 deletions tests/optionsBasic/resize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("resize", () => {
it("should return an error if resizing_type is incorrect", () => {
// @ts-expect-error: Let's ignore an error (check for users with vanilla js).
expect(() => build({ resize: { resizing_type: "fill-up" } })).toThrow(
"resize.resizing_type is invalid. Valid values are: fit, fill, auto, fill_down, force"
"resize.resizing_type is invalid. Valid values are: fit, fill, auto, fill-down, force"
);
});

Expand Down Expand Up @@ -68,10 +68,10 @@ describe("resize", () => {
);
});

it("should return rs:fill_down:::t if resizing_type is 'fill_down' and enlarge is true, other parametres are undefined", () => {
it("should return rs:fill-down:::t if resizing_type is 'fill-down' and enlarge is true, other parametres are undefined", () => {
expect(
build({ rs: { resizing_type: "fill_down", enlarge: true } })
).toEqual("rs:fill_down:::t");
build({ rs: { resizing_type: "fill-down", enlarge: true } })
).toEqual("rs:fill-down:::t");
});

it("should return rs::::t:t if enlarge and extend are 't'", () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/optionsBasic/resizingType.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ describe("resizingType", () => {
expect(() => build({})).toThrow("resizing_type option is undefined");
});

it("should throw an error if resizing_type is not one of 'fit', 'fill', 'fill_down', 'force', 'auto'", () => {
it("should throw an error if resizing_type is not one of 'fit', 'fill', 'fill-down', 'force', 'auto'", () => {
// @ts-expect-error: Let's ignore an error (check for users with vanilla js).
expect(() => build({ resizing_type: "foo" })).toThrow(
"resizing_type option is invalid. Valid values are: fit, fill, fill_down, force, auto"
"resizing_type option is invalid. Valid values are: fit, fill, fill-down, force, auto"
);
});

Expand Down

0 comments on commit 52392b9

Please sign in to comment.