5
5
Position ,
6
6
} from "../getCypressElementCoordinates" ;
7
7
import { mouseButtonNumbers } from "../mouseButtonNumbers" ;
8
+ import { keyToModifierBitMap } from "../keyToModifierBitMap" ;
8
9
9
10
export interface RealClickOptions {
10
11
/** Pointer type for realClick, if "pen" touch simulated */
@@ -38,6 +39,11 @@ export interface RealClickOptions {
38
39
* @example cy.realClick({ clickCount: 2 });
39
40
*/
40
41
clickCount ?: number ;
42
+ /**
43
+ * Indicates whether the shift key was pressed or not when an event occurred
44
+ * @example cy.realClick({ shiftKey: true });
45
+ */
46
+ shiftKey ?: boolean ;
41
47
}
42
48
43
49
/** @ignore this, update documentation for this function at index.d.ts */
@@ -78,6 +84,7 @@ export async function realClick(
78
84
buttons : mouseButtonNumbers [ options . button ?? "left" ] ,
79
85
pointerType : options . pointer ?? "mouse" ,
80
86
button : options . button ?? "left" ,
87
+ modifiers : options . shiftKey ? keyToModifierBitMap . Shift : 0 ,
81
88
} ) ;
82
89
83
90
await fireCdpCommand ( "Input.dispatchMouseEvent" , {
@@ -88,6 +95,7 @@ export async function realClick(
88
95
buttons : mouseButtonNumbers [ options . button ?? "left" ] ,
89
96
pointerType : options . pointer ?? "mouse" ,
90
97
button : options . button ?? "left" ,
98
+ modifiers : options . shiftKey ? keyToModifierBitMap . Shift : 0 ,
91
99
} ) ;
92
100
}
93
101
0 commit comments