File tree 10 files changed +126
-2
lines changed
10 files changed +126
-2
lines changed Original file line number Diff line number Diff line change
1
+ trailingComma : all
2
+ tabWidth : 4
Original file line number Diff line number Diff line change 1
1
export * from "./1_16.js" ;
2
2
export * from "./1_22.js" ;
3
3
export * from "./2_0.js" ;
4
+ export * from "./2_1.js" ;
4
5
export * from "./latest.js" ;
5
6
export * from "./types.js" ;
Original file line number Diff line number Diff line change 1
- import { AdbScrcpyOptions2_0 } from "./2_0 .js" ;
1
+ import { AdbScrcpyOptions2_1 } from "./2_1 .js" ;
2
2
3
- export class AdbScrcpyOptionsLatest extends AdbScrcpyOptions2_0 { }
3
+ export class AdbScrcpyOptionsLatest extends AdbScrcpyOptions2_1 { }
Original file line number Diff line number Diff line change @@ -22,4 +22,12 @@ describe("ScrcpyOptions1_16", () => {
22
22
] ) ;
23
23
} ) ;
24
24
} ) ;
25
+
26
+ describe ( "setListDisplays" , ( ) => {
27
+ it ( "should set `display` to `-1`" , ( ) => {
28
+ const options = new ScrcpyOptions1_16 ( { } ) ;
29
+ options . setListDisplays ( ) ;
30
+ expect ( options . value . displayId ) . toBe ( - 1 ) ;
31
+ } ) ;
32
+ } ) ;
25
33
} ) ;
Original file line number Diff line number Diff line change
1
+ import { describe , expect , it } from "@jest/globals" ;
2
+
3
+ import { ScrcpyOptions1_17 } from "./1_17.js" ;
4
+
5
+ describe ( "ScrcpyOptions1_17" , ( ) => {
6
+ it ( "should share `value` with `base`" , ( ) => {
7
+ const options = new ScrcpyOptions1_17 ( { } ) ;
8
+ expect ( options . value ) . toBe ( options [ "_base" ] . value ) ;
9
+ } ) ;
10
+
11
+ describe ( "setListDisplays" , ( ) => {
12
+ it ( "should set `displayId` to `-1`" , ( ) => {
13
+ const options = new ScrcpyOptions1_17 ( { } ) ;
14
+ options . setListDisplays ( ) ;
15
+ expect ( options . value . displayId ) . toBe ( - 1 ) ;
16
+ } ) ;
17
+ } ) ;
18
+
19
+ describe ( "setListEncoders" , ( ) => {
20
+ it ( "should set `encoderName` to `_`" , ( ) => {
21
+ const options = new ScrcpyOptions1_17 ( { } ) ;
22
+ options . setListEncoders ( ) ;
23
+ expect ( options . value . encoderName ) . toBe ( "_" ) ;
24
+ } ) ;
25
+ } ) ;
26
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { describe , expect , it } from "@jest/globals" ;
2
+
3
+ import { ScrcpyOptions1_18 } from "./1_18.js" ;
4
+
5
+ describe ( "ScrcpyOptions1_18" , ( ) => {
6
+ it ( "should share `value` with `base`" , ( ) => {
7
+ const options = new ScrcpyOptions1_18 ( { } ) ;
8
+ expect ( options . value ) . toBe ( options [ "_base" ] . value ) ;
9
+ } ) ;
10
+
11
+ describe ( "setListDisplays" , ( ) => {
12
+ it ( "should set `displayId` to `-1`" , ( ) => {
13
+ const options = new ScrcpyOptions1_18 ( { } ) ;
14
+ options . setListDisplays ( ) ;
15
+ expect ( options . value . displayId ) . toBe ( - 1 ) ;
16
+ } ) ;
17
+ } ) ;
18
+
19
+ describe ( "setListEncoders" , ( ) => {
20
+ it ( "should set `encoderName` to `_`" , ( ) => {
21
+ const options = new ScrcpyOptions1_18 ( { } ) ;
22
+ options . setListEncoders ( ) ;
23
+ expect ( options . value . encoderName ) . toBe ( "_" ) ;
24
+ } ) ;
25
+ } ) ;
26
+ } ) ;
Original file line number Diff line number Diff line change @@ -14,4 +14,12 @@ describe("ScrcpyOptions1_25", () => {
14
14
) . createScrollController ( ) ;
15
15
expect ( controller1_25 ) . not . toBe ( controller1_24 ) ;
16
16
} ) ;
17
+
18
+ describe ( "setListDisplays" , ( ) => {
19
+ it ( "should set `display` to `-1`" , ( ) => {
20
+ const options = new ScrcpyOptions1_25 ( { } ) ;
21
+ options . setListDisplays ( ) ;
22
+ expect ( options . value . displayId ) . toBe ( - 1 ) ;
23
+ } ) ;
24
+ } ) ;
17
25
} ) ;
Original file line number Diff line number Diff line change
1
+ import { describe , expect , it } from "@jest/globals" ;
2
+
3
+ import { ScrcpyOptions2_0 } from "./2_0.js" ;
4
+
5
+ describe ( "ScrcpyOptions2_0" , ( ) => {
6
+ describe ( "setListDisplays" , ( ) => {
7
+ it ( "should set `listDisplays` to `true`" , ( ) => {
8
+ const options = new ScrcpyOptions2_0 ( { } ) ;
9
+ options . setListDisplays ( ) ;
10
+ expect ( options . value . listDisplays ) . toBe ( true ) ;
11
+ } ) ;
12
+ } ) ;
13
+
14
+ describe ( "setListEncoders" , ( ) => {
15
+ it ( "should set `listEncoders` to `true`" , ( ) => {
16
+ const options = new ScrcpyOptions2_0 ( { } ) ;
17
+ options . setListEncoders ( ) ;
18
+ expect ( options . value . listEncoders ) . toBe ( true ) ;
19
+ } ) ;
20
+ } ) ;
21
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { describe , expect , it } from "@jest/globals" ;
2
+
3
+ import { ScrcpyOptions2_1 } from "./2_1.js" ;
4
+
5
+ describe ( "ScrcpyOptions2_1" , ( ) => {
6
+ describe ( "setListDisplays" , ( ) => {
7
+ it ( "should set `listDisplays` to `true`" , ( ) => {
8
+ const options = new ScrcpyOptions2_1 ( { } ) ;
9
+ options . setListDisplays ( ) ;
10
+ expect ( options . value . listDisplays ) . toBe ( true ) ;
11
+ } ) ;
12
+ } ) ;
13
+
14
+ describe ( "setListEncoders" , ( ) => {
15
+ it ( "should set `listEncoders` to `true`" , ( ) => {
16
+ const options = new ScrcpyOptions2_1 ( { } ) ;
17
+ options . setListEncoders ( ) ;
18
+ expect ( options . value . listEncoders ) . toBe ( true ) ;
19
+ } ) ;
20
+ } ) ;
21
+ } ) ;
Original file line number Diff line number Diff line change @@ -141,6 +141,17 @@ export abstract class ScrcpyOptionsBase<
141
141
constructor ( base : B , value : Required < T > ) {
142
142
this . _base = base ;
143
143
this . value = value ;
144
+ this . #setValue( ) ;
145
+ }
146
+
147
+ #setValue( ) {
148
+ // Share `value` with `_base` class,
149
+ // so updating `_base.value` in `_base.setListEncoders()`/
150
+ // `_base.setListDisplays()` will also update `this.value`.
151
+ Object . assign ( this . _base , { value : this . value } ) ;
152
+ if ( this . _base instanceof ScrcpyOptionsBase ) {
153
+ this . _base . #setValue( ) ;
154
+ }
144
155
}
145
156
146
157
abstract serialize ( ) : string [ ] ;
You can’t perform that action at this time.
0 commit comments