File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Transformation } from "../../../src" ;
2
+ import { Adjust } from "../../../src/actions/adjust" ;
3
+
4
+ describe ( 'Adjust toJson()' , ( ) => {
5
+ it ( 'adjust.improve' , ( ) => {
6
+ const transformation = new Transformation ( )
7
+ . addAction ( Adjust . improve ( ) . mode ( 'outdoor' ) . blend ( 50 ) ) ;
8
+ expect ( transformation . toJson ( ) ) . toStrictEqual ( [
9
+ {
10
+ actionType : 'improve' ,
11
+ mode : 'outdoor' ,
12
+ blend : 50
13
+ }
14
+ ] ) ;
15
+ } ) ;
16
+ } ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import {Action} from "../../internal/Action.js";
2
2
import { QualifierValue } from "../../internal/qualifier/QualifierValue.js" ;
3
3
import { Qualifier } from "../../internal/qualifier/Qualifier.js" ;
4
4
import { stringOrNumber } from "../../types/types.js" ;
5
+ import { ImproveActionModel } from "../../internal/models/IAdjustActionModel" ;
5
6
6
7
/**
7
8
* @description Defines how to improve an image by automatically adjusting image colors, contrast and brightness.</br>
@@ -11,6 +12,7 @@ import {stringOrNumber} from "../../types/types.js";
11
12
class ImproveAction extends Action {
12
13
private modeValue :stringOrNumber ;
13
14
private blendValue :number ;
15
+ protected _actionModel : ImproveActionModel = { actionType : 'improve' } ;
14
16
constructor ( ) {
15
17
super ( ) ;
16
18
}
@@ -22,6 +24,7 @@ class ImproveAction extends Action {
22
24
*/
23
25
mode ( value : 'outdoor' | 'indoor' | string ) : this {
24
26
this . modeValue = value ;
27
+ this . _actionModel . mode = value ;
25
28
return this ;
26
29
}
27
30
@@ -31,6 +34,7 @@ class ImproveAction extends Action {
31
34
*/
32
35
blend ( value :number ) : this {
33
36
this . blendValue = value ;
37
+ this . _actionModel . blend = value ;
34
38
return this ;
35
39
}
36
40
Original file line number Diff line number Diff line change
1
+ import { IActionModel } from "./IActionModel.js" ;
2
+
3
+ interface ImproveActionModel extends IActionModel {
4
+ mode ?: string ;
5
+ blend ?: number ;
6
+ }
7
+
8
+ export { ImproveActionModel } ;
You can’t perform that action at this time.
0 commit comments