Skip to content

Commit fb6b334

Browse files
committed
add saturatiion to/fromJson
1 parent 8243687 commit fb6b334

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

__TESTS__/unit/fromJson/adjust.fromJson.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ describe('adjust.fromJson', () => {
44
it('should generate a url with adjust actions from array of models', function () {
55
const transformation = fromJson([
66
{ actionType: 'improve', mode: 'outdoor', blend: 30},
7-
{ actionType: 'unsharpMask', level: 50}
7+
{ actionType: 'unsharpMask', level: 50},
8+
{ actionType: 'saturation', level: 40}
89
]);
910

1011
expect(transformation.toString()).toStrictEqual([
1112
'e_improve:outdoor:30',
12-
'e_unsharp_mask:50'
13+
'e_unsharp_mask:50',
14+
'e_saturation:40'
1315
].join('/'));
1416
});
1517
});

__TESTS__/unit/toJson/adjust.toJson.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,15 @@ describe('Adjust toJson()', () => {
2424
}
2525
]);
2626
});
27+
28+
it('adjust.saturation', () => {
29+
const transformation = new Transformation()
30+
.addAction(Adjust.saturation().level(50));
31+
expect(transformation.toJson()).toStrictEqual( [
32+
{
33+
actionType: 'saturation',
34+
level: 50
35+
}
36+
]);
37+
});
2738
});

src/internal/fromJson.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ const ActionModelMap: Record<string, IHasFromJson> = {
8484
pixelate: Pixelate,
8585
blur: BlurAction,
8686
improve: ImproveAction,
87-
unsharpMask: EffectActionWithStrength
87+
unsharpMask: EffectActionWithStrength,
88+
saturation: EffectActionWithLevel
8889
};
8990

9091
/**

0 commit comments

Comments
 (0)