@@ -81,10 +81,10 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
81
81
await page . keyboard . sendCharacter ( 'a' ) ;
82
82
expect ( await page . evaluate ( ( ) => document . querySelector ( 'textarea' ) . value ) ) . toBe ( '嗨a' ) ;
83
83
} ) ;
84
- it_fails_ffox ( 'should report shiftKey' , async ( { page, server} ) => {
84
+ it ( 'should report shiftKey' , async ( { page, server} ) => {
85
85
await page . goto ( server . PREFIX + '/input/keyboard.html' ) ;
86
86
const keyboard = page . keyboard ;
87
- const codeForKey = { 'Shift' : 16 , 'Alt' : 18 , 'Meta' : 91 , ' Control' : 17 } ;
87
+ const codeForKey = { 'Shift' : 16 , 'Alt' : 18 , 'Control' : 17 } ;
88
88
for ( const modifierKey in codeForKey ) {
89
89
await keyboard . down ( modifierKey ) ;
90
90
expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keydown: ' + modifierKey + ' ' + modifierKey + 'Left ' + codeForKey [ modifierKey ] + ' [' + modifierKey + ']' ) ;
@@ -101,21 +101,21 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
101
101
expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keyup: ' + modifierKey + ' ' + modifierKey + 'Left ' + codeForKey [ modifierKey ] + ' []' ) ;
102
102
}
103
103
} ) ;
104
- it_fails_ffox ( 'should report multiple modifiers' , async ( { page, server} ) => {
104
+ it ( 'should report multiple modifiers' , async ( { page, server} ) => {
105
105
await page . goto ( server . PREFIX + '/input/keyboard.html' ) ;
106
106
const keyboard = page . keyboard ;
107
107
await keyboard . down ( 'Control' ) ;
108
108
expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keydown: Control ControlLeft 17 [Control]' ) ;
109
- await keyboard . down ( 'Meta ' ) ;
110
- expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keydown: Meta MetaLeft 91 [Control Meta ]' ) ;
109
+ await keyboard . down ( 'Alt ' ) ;
110
+ expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keydown: Alt AltLeft 18 [Alt Control ]' ) ;
111
111
await keyboard . down ( ';' ) ;
112
- expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keydown: ; Semicolon 186 [Control Meta ]' ) ;
112
+ expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keydown: ; Semicolon 186 [Alt Control ]' ) ;
113
113
await keyboard . up ( ';' ) ;
114
- expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keyup: ; Semicolon 186 [Control Meta ]' ) ;
114
+ expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keyup: ; Semicolon 186 [Alt Control ]' ) ;
115
115
await keyboard . up ( 'Control' ) ;
116
- expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keyup: Control ControlLeft 17 [Meta ]' ) ;
117
- await keyboard . up ( 'Meta ' ) ;
118
- expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keyup: Meta MetaLeft 91 []' ) ;
116
+ expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keyup: Control ControlLeft 17 [Alt ]' ) ;
117
+ await keyboard . up ( 'Alt ' ) ;
118
+ expect ( await page . evaluate ( ( ) => getResult ( ) ) ) . toBe ( 'Keyup: Alt AltLeft 18 []' ) ;
119
119
} ) ;
120
120
it ( 'should send proper codes while typing' , async ( { page, server} ) => {
121
121
await page . goto ( server . PREFIX + '/input/keyboard.html' ) ;
@@ -225,5 +225,30 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
225
225
await textarea . type ( '👹 Tokyo street Japan 🇯🇵' ) ;
226
226
expect ( await frame . $eval ( 'textarea' , textarea => textarea . value ) ) . toBe ( '👹 Tokyo street Japan 🇯🇵' ) ;
227
227
} ) ;
228
+ it ( 'should press the meta key' , async ( { page} ) => {
229
+ await page . evaluate ( ( ) => {
230
+ window . result = null ;
231
+ document . addEventListener ( 'keydown' , event => {
232
+ window . result = [ event . key , event . code , event . metaKey ] ;
233
+ } ) ;
234
+ } ) ;
235
+ await page . keyboard . press ( 'Meta' ) ;
236
+ const [ key , code , metaKey ] = await page . evaluate ( 'result' ) ;
237
+ if ( FFOX && os . platform ( ) !== 'darwin' )
238
+ expect ( key ) . toBe ( 'OS' ) ;
239
+ else
240
+ expect ( key ) . toBe ( 'Meta' ) ;
241
+
242
+ if ( FFOX )
243
+ expect ( code ) . toBe ( 'OSLeft' ) ;
244
+ else
245
+ expect ( code ) . toBe ( 'MetaLeft' ) ;
246
+
247
+ if ( FFOX && os . platform ( ) !== 'darwin' )
248
+ expect ( metaKey ) . toBe ( false ) ;
249
+ else
250
+ expect ( metaKey ) . toBe ( true ) ;
251
+
252
+ } ) ;
228
253
} ) ;
229
254
} ;
0 commit comments