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";
22import { QualifierValue } from "../../internal/qualifier/QualifierValue.js" ;
33import { Qualifier } from "../../internal/qualifier/Qualifier.js" ;
44import { stringOrNumber } from "../../types/types.js" ;
5+ import { ImproveActionModel } from "../../internal/models/IAdjustActionModel" ;
56
67/**
78 * @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";
1112class ImproveAction extends Action {
1213 private modeValue :stringOrNumber ;
1314 private blendValue :number ;
15+ protected _actionModel : ImproveActionModel = { actionType : 'improve' } ;
1416 constructor ( ) {
1517 super ( ) ;
1618 }
@@ -22,6 +24,7 @@ class ImproveAction extends Action {
2224 */
2325 mode ( value : 'outdoor' | 'indoor' | string ) : this {
2426 this . modeValue = value ;
27+ this . _actionModel . mode = value ;
2528 return this ;
2629 }
2730
@@ -31,6 +34,7 @@ class ImproveAction extends Action {
3134 */
3235 blend ( value :number ) : this {
3336 this . blendValue = value ;
37+ this . _actionModel . blend = value ;
3438 return this ;
3539 }
3640
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