File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,29 @@ describe("Mouse class", () => {
142
142
expect ( result ) . toBe ( SUT ) ;
143
143
} ) ;
144
144
145
+ it ( "should convert single point inputs to an array" , async ( ) => {
146
+ // GIVEN
147
+ const SUT = new MouseClass ( providerRegistryMock ) ;
148
+ const testPoint = new Point ( 0 , 0 ) ;
149
+
150
+ const setPositionMock = jest . fn ( ) ;
151
+ providerRegistryMock . getMouse = jest . fn ( ( ) =>
152
+ mockPartial < MouseProviderInterface > ( {
153
+ setMouseDelay : jest . fn ( ) ,
154
+ setMousePosition : setPositionMock ,
155
+ } )
156
+ ) ;
157
+ providerRegistryMock . getLogProvider = ( ) => new NoopLogProvider ( ) ;
158
+
159
+ // WHEN
160
+ const result = await SUT . move ( testPoint as unknown as Array < Point > ) ;
161
+
162
+ // THEN
163
+ expect ( setPositionMock ) . toBeCalledTimes ( 1 ) ;
164
+ expect ( setPositionMock ) . toBeCalledWith ( testPoint ) ;
165
+ expect ( result ) . toBe ( SUT ) ;
166
+ } ) ;
167
+
145
168
it ( "should press and hold left mouse button, move and release left mouse button on drag" , async ( ) => {
146
169
// GIVEN
147
170
const SUT = new MouseClass ( providerRegistryMock ) ;
Original file line number Diff line number Diff line change @@ -90,7 +90,10 @@ export class MouseClass {
90
90
) : Promise < MouseClass > {
91
91
return new Promise < MouseClass > ( async ( resolve , reject ) => {
92
92
try {
93
- const pathSteps = await path ;
93
+ let pathSteps = await path ;
94
+ if ( ! Array . isArray ( pathSteps ) ) {
95
+ pathSteps = [ pathSteps ] ;
96
+ }
94
97
this . providerRegistry
95
98
. getLogProvider ( )
96
99
. info (
You can’t perform that action at this time.
0 commit comments